#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 acceptedGiftTypes::Class;
jfieldID acceptedGiftTypes::unlimited_gifts_fieldID;
jfieldID acceptedGiftTypes::limited_gifts_fieldID;
jfieldID acceptedGiftTypes::upgraded_gifts_fieldID;
jfieldID acceptedGiftTypes::gifts_from_channels_fieldID;
jfieldID acceptedGiftTypes::premium_subscription_fieldID;

acceptedGiftTypes::acceptedGiftTypes()
  : unlimited_gifts_()
  , limited_gifts_()
  , upgraded_gifts_()
  , gifts_from_channels_()
  , premium_subscription_()
{}

acceptedGiftTypes::acceptedGiftTypes(bool unlimited_gifts_, bool limited_gifts_, bool upgraded_gifts_, bool gifts_from_channels_, bool premium_subscription_)
  : unlimited_gifts_(unlimited_gifts_)
  , limited_gifts_(limited_gifts_)
  , upgraded_gifts_(upgraded_gifts_)
  , gifts_from_channels_(gifts_from_channels_)
  , premium_subscription_(premium_subscription_)
{}

const std::int32_t acceptedGiftTypes::ID;

object_ptr<acceptedGiftTypes> acceptedGiftTypes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<acceptedGiftTypes> res = make_object<acceptedGiftTypes>();
  res->unlimited_gifts_ = (env->GetBooleanField(p, res->unlimited_gifts_fieldID) != 0);
  res->limited_gifts_ = (env->GetBooleanField(p, res->limited_gifts_fieldID) != 0);
  res->upgraded_gifts_ = (env->GetBooleanField(p, res->upgraded_gifts_fieldID) != 0);
  res->gifts_from_channels_ = (env->GetBooleanField(p, res->gifts_from_channels_fieldID) != 0);
  res->premium_subscription_ = (env->GetBooleanField(p, res->premium_subscription_fieldID) != 0);
  return res;
}

void acceptedGiftTypes::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, unlimited_gifts_fieldID, unlimited_gifts_);
  env->SetBooleanField(s, limited_gifts_fieldID, limited_gifts_);
  env->SetBooleanField(s, upgraded_gifts_fieldID, upgraded_gifts_);
  env->SetBooleanField(s, gifts_from_channels_fieldID, gifts_from_channels_);
  env->SetBooleanField(s, premium_subscription_fieldID, premium_subscription_);
}

void acceptedGiftTypes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AcceptedGiftTypes");
    s.store_field("unlimitedGifts", unlimited_gifts_);
    s.store_field("limitedGifts", limited_gifts_);
    s.store_field("upgradedGifts", upgraded_gifts_);
    s.store_field("giftsFromChannels", gifts_from_channels_);
    s.store_field("premiumSubscription", premium_subscription_);
    s.store_class_end();
  }
}

void acceptedGiftTypes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AcceptedGiftTypes").c_str());
    unlimited_gifts_fieldID = jni::get_field_id(env, Class, "unlimitedGifts", "Z");
    limited_gifts_fieldID = jni::get_field_id(env, Class, "limitedGifts", "Z");
    upgraded_gifts_fieldID = jni::get_field_id(env, Class, "upgradedGifts", "Z");
    gifts_from_channels_fieldID = jni::get_field_id(env, Class, "giftsFromChannels", "Z");
    premium_subscription_fieldID = jni::get_field_id(env, Class, "premiumSubscription", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass AffiliateProgramSortOrder::Class;

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

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

jclass affiliateProgramSortOrderProfitability::Class;

affiliateProgramSortOrderProfitability::affiliateProgramSortOrderProfitability() {
}

const std::int32_t affiliateProgramSortOrderProfitability::ID;

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

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

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

jclass affiliateProgramSortOrderCreationDate::Class;

affiliateProgramSortOrderCreationDate::affiliateProgramSortOrderCreationDate() {
}

const std::int32_t affiliateProgramSortOrderCreationDate::ID;

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

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

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

jclass affiliateProgramSortOrderRevenue::Class;

affiliateProgramSortOrderRevenue::affiliateProgramSortOrderRevenue() {
}

const std::int32_t affiliateProgramSortOrderRevenue::ID;

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

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

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

jclass auctionRound::Class;
jfieldID auctionRound::number_fieldID;
jfieldID auctionRound::duration_fieldID;
jfieldID auctionRound::extend_time_fieldID;
jfieldID auctionRound::top_winner_count_fieldID;

auctionRound::auctionRound()
  : number_()
  , duration_()
  , extend_time_()
  , top_winner_count_()
{}

auctionRound::auctionRound(int32 number_, int32 duration_, int32 extend_time_, int32 top_winner_count_)
  : number_(number_)
  , duration_(duration_)
  , extend_time_(extend_time_)
  , top_winner_count_(top_winner_count_)
{}

const std::int32_t auctionRound::ID;

object_ptr<auctionRound> auctionRound::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<auctionRound> res = make_object<auctionRound>();
  res->number_ = env->GetIntField(p, res->number_fieldID);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->extend_time_ = env->GetIntField(p, res->extend_time_fieldID);
  res->top_winner_count_ = env->GetIntField(p, res->top_winner_count_fieldID);
  return res;
}

void auctionRound::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, number_fieldID, number_);
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, extend_time_fieldID, extend_time_);
  env->SetIntField(s, top_winner_count_fieldID, top_winner_count_);
}

void auctionRound::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AuctionRound");
    s.store_field("number", number_);
    s.store_field("duration", duration_);
    s.store_field("extendTime", extend_time_);
    s.store_field("topWinnerCount", top_winner_count_);
    s.store_class_end();
  }
}

void auctionRound::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AuctionRound").c_str());
    number_fieldID = jni::get_field_id(env, Class, "number", "I");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    extend_time_fieldID = jni::get_field_id(env, Class, "extendTime", "I");
    top_winner_count_fieldID = jni::get_field_id(env, Class, "topWinnerCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass autoDownloadSettings::Class;
jfieldID autoDownloadSettings::is_auto_download_enabled_fieldID;
jfieldID autoDownloadSettings::max_photo_file_size_fieldID;
jfieldID autoDownloadSettings::max_video_file_size_fieldID;
jfieldID autoDownloadSettings::max_other_file_size_fieldID;
jfieldID autoDownloadSettings::video_upload_bitrate_fieldID;
jfieldID autoDownloadSettings::preload_large_videos_fieldID;
jfieldID autoDownloadSettings::preload_next_audio_fieldID;
jfieldID autoDownloadSettings::preload_stories_fieldID;
jfieldID autoDownloadSettings::use_less_data_for_calls_fieldID;

autoDownloadSettings::autoDownloadSettings()
  : is_auto_download_enabled_()
  , max_photo_file_size_()
  , max_video_file_size_()
  , max_other_file_size_()
  , video_upload_bitrate_()
  , preload_large_videos_()
  , preload_next_audio_()
  , preload_stories_()
  , use_less_data_for_calls_()
{}

autoDownloadSettings::autoDownloadSettings(bool is_auto_download_enabled_, int32 max_photo_file_size_, int53 max_video_file_size_, int53 max_other_file_size_, int32 video_upload_bitrate_, bool preload_large_videos_, bool preload_next_audio_, bool preload_stories_, bool use_less_data_for_calls_)
  : is_auto_download_enabled_(is_auto_download_enabled_)
  , max_photo_file_size_(max_photo_file_size_)
  , max_video_file_size_(max_video_file_size_)
  , max_other_file_size_(max_other_file_size_)
  , video_upload_bitrate_(video_upload_bitrate_)
  , preload_large_videos_(preload_large_videos_)
  , preload_next_audio_(preload_next_audio_)
  , preload_stories_(preload_stories_)
  , use_less_data_for_calls_(use_less_data_for_calls_)
{}

const std::int32_t autoDownloadSettings::ID;

object_ptr<autoDownloadSettings> autoDownloadSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<autoDownloadSettings> res = make_object<autoDownloadSettings>();
  res->is_auto_download_enabled_ = (env->GetBooleanField(p, res->is_auto_download_enabled_fieldID) != 0);
  res->max_photo_file_size_ = env->GetIntField(p, res->max_photo_file_size_fieldID);
  res->max_video_file_size_ = env->GetLongField(p, res->max_video_file_size_fieldID);
  res->max_other_file_size_ = env->GetLongField(p, res->max_other_file_size_fieldID);
  res->video_upload_bitrate_ = env->GetIntField(p, res->video_upload_bitrate_fieldID);
  res->preload_large_videos_ = (env->GetBooleanField(p, res->preload_large_videos_fieldID) != 0);
  res->preload_next_audio_ = (env->GetBooleanField(p, res->preload_next_audio_fieldID) != 0);
  res->preload_stories_ = (env->GetBooleanField(p, res->preload_stories_fieldID) != 0);
  res->use_less_data_for_calls_ = (env->GetBooleanField(p, res->use_less_data_for_calls_fieldID) != 0);
  return res;
}

void autoDownloadSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_auto_download_enabled_fieldID, is_auto_download_enabled_);
  env->SetIntField(s, max_photo_file_size_fieldID, max_photo_file_size_);
  env->SetLongField(s, max_video_file_size_fieldID, max_video_file_size_);
  env->SetLongField(s, max_other_file_size_fieldID, max_other_file_size_);
  env->SetIntField(s, video_upload_bitrate_fieldID, video_upload_bitrate_);
  env->SetBooleanField(s, preload_large_videos_fieldID, preload_large_videos_);
  env->SetBooleanField(s, preload_next_audio_fieldID, preload_next_audio_);
  env->SetBooleanField(s, preload_stories_fieldID, preload_stories_);
  env->SetBooleanField(s, use_less_data_for_calls_fieldID, use_less_data_for_calls_);
}

void autoDownloadSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AutoDownloadSettings");
    s.store_field("isAutoDownloadEnabled", is_auto_download_enabled_);
    s.store_field("maxPhotoFileSize", max_photo_file_size_);
    s.store_field("maxVideoFileSize", max_video_file_size_);
    s.store_field("maxOtherFileSize", max_other_file_size_);
    s.store_field("videoUploadBitrate", video_upload_bitrate_);
    s.store_field("preloadLargeVideos", preload_large_videos_);
    s.store_field("preloadNextAudio", preload_next_audio_);
    s.store_field("preloadStories", preload_stories_);
    s.store_field("useLessDataForCalls", use_less_data_for_calls_);
    s.store_class_end();
  }
}

void autoDownloadSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AutoDownloadSettings").c_str());
    is_auto_download_enabled_fieldID = jni::get_field_id(env, Class, "isAutoDownloadEnabled", "Z");
    max_photo_file_size_fieldID = jni::get_field_id(env, Class, "maxPhotoFileSize", "I");
    max_video_file_size_fieldID = jni::get_field_id(env, Class, "maxVideoFileSize", "J");
    max_other_file_size_fieldID = jni::get_field_id(env, Class, "maxOtherFileSize", "J");
    video_upload_bitrate_fieldID = jni::get_field_id(env, Class, "videoUploadBitrate", "I");
    preload_large_videos_fieldID = jni::get_field_id(env, Class, "preloadLargeVideos", "Z");
    preload_next_audio_fieldID = jni::get_field_id(env, Class, "preloadNextAudio", "Z");
    preload_stories_fieldID = jni::get_field_id(env, Class, "preloadStories", "Z");
    use_less_data_for_calls_fieldID = jni::get_field_id(env, Class, "useLessDataForCalls", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass AutosaveSettingsScope::Class;

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

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

jclass autosaveSettingsScopePrivateChats::Class;

autosaveSettingsScopePrivateChats::autosaveSettingsScopePrivateChats() {
}

const std::int32_t autosaveSettingsScopePrivateChats::ID;

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

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

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

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

jclass autosaveSettingsScopeGroupChats::Class;

autosaveSettingsScopeGroupChats::autosaveSettingsScopeGroupChats() {
}

const std::int32_t autosaveSettingsScopeGroupChats::ID;

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

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

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

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

jclass autosaveSettingsScopeChannelChats::Class;

autosaveSettingsScopeChannelChats::autosaveSettingsScopeChannelChats() {
}

const std::int32_t autosaveSettingsScopeChannelChats::ID;

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

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

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

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

jclass autosaveSettingsScopeChat::Class;
jfieldID autosaveSettingsScopeChat::chat_id_fieldID;

autosaveSettingsScopeChat::autosaveSettingsScopeChat()
  : chat_id_()
{}

autosaveSettingsScopeChat::autosaveSettingsScopeChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t autosaveSettingsScopeChat::ID;

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

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

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

jclass bankCardActionOpenUrl::Class;
jfieldID bankCardActionOpenUrl::text_fieldID;
jfieldID bankCardActionOpenUrl::url_fieldID;

bankCardActionOpenUrl::bankCardActionOpenUrl()
  : text_()
  , url_()
{}

bankCardActionOpenUrl::bankCardActionOpenUrl(string const &text_, string const &url_)
  : text_(text_)
  , url_(url_)
{}

const std::int32_t bankCardActionOpenUrl::ID;

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

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

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

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

jclass BlockList::Class;

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

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

jclass blockListMain::Class;

blockListMain::blockListMain() {
}

const std::int32_t blockListMain::ID;

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

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

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

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

jclass blockListStories::Class;

blockListStories::blockListStories() {
}

const std::int32_t blockListStories::ID;

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

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

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

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

jclass BotCommandScope::Class;

object_ptr<BotCommandScope> BotCommandScope::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case botCommandScopeDefault::ID:
      return botCommandScopeDefault::fetch(env, p);
    case botCommandScopeAllPrivateChats::ID:
      return botCommandScopeAllPrivateChats::fetch(env, p);
    case botCommandScopeAllGroupChats::ID:
      return botCommandScopeAllGroupChats::fetch(env, p);
    case botCommandScopeAllChatAdministrators::ID:
      return botCommandScopeAllChatAdministrators::fetch(env, p);
    case botCommandScopeChat::ID:
      return botCommandScopeChat::fetch(env, p);
    case botCommandScopeChatAdministrators::ID:
      return botCommandScopeChatAdministrators::fetch(env, p);
    case botCommandScopeChatMember::ID:
      return botCommandScopeChatMember::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass botCommandScopeDefault::Class;

botCommandScopeDefault::botCommandScopeDefault() {
}

const std::int32_t botCommandScopeDefault::ID;

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

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

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

jclass botCommandScopeAllPrivateChats::Class;

botCommandScopeAllPrivateChats::botCommandScopeAllPrivateChats() {
}

const std::int32_t botCommandScopeAllPrivateChats::ID;

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

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

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

jclass botCommandScopeAllGroupChats::Class;

botCommandScopeAllGroupChats::botCommandScopeAllGroupChats() {
}

const std::int32_t botCommandScopeAllGroupChats::ID;

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

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

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

jclass botCommandScopeAllChatAdministrators::Class;

botCommandScopeAllChatAdministrators::botCommandScopeAllChatAdministrators() {
}

const std::int32_t botCommandScopeAllChatAdministrators::ID;

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

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

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

jclass botCommandScopeChat::Class;
jfieldID botCommandScopeChat::chat_id_fieldID;

botCommandScopeChat::botCommandScopeChat()
  : chat_id_()
{}

botCommandScopeChat::botCommandScopeChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t botCommandScopeChat::ID;

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

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

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

jclass botCommandScopeChatAdministrators::Class;
jfieldID botCommandScopeChatAdministrators::chat_id_fieldID;

botCommandScopeChatAdministrators::botCommandScopeChatAdministrators()
  : chat_id_()
{}

botCommandScopeChatAdministrators::botCommandScopeChatAdministrators(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t botCommandScopeChatAdministrators::ID;

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

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

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

jclass botCommandScopeChatMember::Class;
jfieldID botCommandScopeChatMember::chat_id_fieldID;
jfieldID botCommandScopeChatMember::user_id_fieldID;

botCommandScopeChatMember::botCommandScopeChatMember()
  : chat_id_()
  , user_id_()
{}

botCommandScopeChatMember::botCommandScopeChatMember(int53 chat_id_, int53 user_id_)
  : chat_id_(chat_id_)
  , user_id_(user_id_)
{}

const std::int32_t botCommandScopeChatMember::ID;

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

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

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

jclass BusinessFeature::Class;

object_ptr<BusinessFeature> BusinessFeature::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case businessFeatureLocation::ID:
      return businessFeatureLocation::fetch(env, p);
    case businessFeatureOpeningHours::ID:
      return businessFeatureOpeningHours::fetch(env, p);
    case businessFeatureQuickReplies::ID:
      return businessFeatureQuickReplies::fetch(env, p);
    case businessFeatureGreetingMessage::ID:
      return businessFeatureGreetingMessage::fetch(env, p);
    case businessFeatureAwayMessage::ID:
      return businessFeatureAwayMessage::fetch(env, p);
    case businessFeatureAccountLinks::ID:
      return businessFeatureAccountLinks::fetch(env, p);
    case businessFeatureStartPage::ID:
      return businessFeatureStartPage::fetch(env, p);
    case businessFeatureBots::ID:
      return businessFeatureBots::fetch(env, p);
    case businessFeatureEmojiStatus::ID:
      return businessFeatureEmojiStatus::fetch(env, p);
    case businessFeatureChatFolderTags::ID:
      return businessFeatureChatFolderTags::fetch(env, p);
    case businessFeatureUpgradedStories::ID:
      return businessFeatureUpgradedStories::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass businessFeatureLocation::Class;

businessFeatureLocation::businessFeatureLocation() {
}

const std::int32_t businessFeatureLocation::ID;

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

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

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

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

jclass businessFeatureOpeningHours::Class;

businessFeatureOpeningHours::businessFeatureOpeningHours() {
}

const std::int32_t businessFeatureOpeningHours::ID;

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

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

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

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

jclass businessFeatureQuickReplies::Class;

businessFeatureQuickReplies::businessFeatureQuickReplies() {
}

const std::int32_t businessFeatureQuickReplies::ID;

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

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

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

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

jclass businessFeatureGreetingMessage::Class;

businessFeatureGreetingMessage::businessFeatureGreetingMessage() {
}

const std::int32_t businessFeatureGreetingMessage::ID;

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

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

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

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

jclass businessFeatureAwayMessage::Class;

businessFeatureAwayMessage::businessFeatureAwayMessage() {
}

const std::int32_t businessFeatureAwayMessage::ID;

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

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

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

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

jclass businessFeatureAccountLinks::Class;

businessFeatureAccountLinks::businessFeatureAccountLinks() {
}

const std::int32_t businessFeatureAccountLinks::ID;

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

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

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

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

jclass businessFeatureStartPage::Class;

businessFeatureStartPage::businessFeatureStartPage() {
}

const std::int32_t businessFeatureStartPage::ID;

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

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

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

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

jclass businessFeatureBots::Class;

businessFeatureBots::businessFeatureBots() {
}

const std::int32_t businessFeatureBots::ID;

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

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

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

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

jclass businessFeatureEmojiStatus::Class;

businessFeatureEmojiStatus::businessFeatureEmojiStatus() {
}

const std::int32_t businessFeatureEmojiStatus::ID;

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

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

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

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

jclass businessFeatureChatFolderTags::Class;

businessFeatureChatFolderTags::businessFeatureChatFolderTags() {
}

const std::int32_t businessFeatureChatFolderTags::ID;

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

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

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

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

jclass businessFeatureUpgradedStories::Class;

businessFeatureUpgradedStories::businessFeatureUpgradedStories() {
}

const std::int32_t businessFeatureUpgradedStories::ID;

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

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

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

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

jclass businessOpeningHoursInterval::Class;
jfieldID businessOpeningHoursInterval::start_minute_fieldID;
jfieldID businessOpeningHoursInterval::end_minute_fieldID;

businessOpeningHoursInterval::businessOpeningHoursInterval()
  : start_minute_()
  , end_minute_()
{}

businessOpeningHoursInterval::businessOpeningHoursInterval(int32 start_minute_, int32 end_minute_)
  : start_minute_(start_minute_)
  , end_minute_(end_minute_)
{}

const std::int32_t businessOpeningHoursInterval::ID;

object_ptr<businessOpeningHoursInterval> businessOpeningHoursInterval::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<businessOpeningHoursInterval> res = make_object<businessOpeningHoursInterval>();
  res->start_minute_ = env->GetIntField(p, res->start_minute_fieldID);
  res->end_minute_ = env->GetIntField(p, res->end_minute_fieldID);
  return res;
}

void businessOpeningHoursInterval::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, start_minute_fieldID, start_minute_);
  env->SetIntField(s, end_minute_fieldID, end_minute_);
}

void businessOpeningHoursInterval::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BusinessOpeningHoursInterval");
    s.store_field("startMinute", start_minute_);
    s.store_field("endMinute", end_minute_);
    s.store_class_end();
  }
}

void businessOpeningHoursInterval::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BusinessOpeningHoursInterval").c_str());
    start_minute_fieldID = jni::get_field_id(env, Class, "startMinute", "I");
    end_minute_fieldID = jni::get_field_id(env, Class, "endMinute", "I");
    return true;
  }();
  (void)is_inited;
}

jclass CallServerType::Class;

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

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

jclass callServerTypeTelegramReflector::Class;
jfieldID callServerTypeTelegramReflector::peer_tag_fieldID;
jfieldID callServerTypeTelegramReflector::is_tcp_fieldID;

callServerTypeTelegramReflector::callServerTypeTelegramReflector()
  : peer_tag_()
  , is_tcp_()
{}

callServerTypeTelegramReflector::callServerTypeTelegramReflector(bytes const &peer_tag_, bool is_tcp_)
  : peer_tag_(std::move(peer_tag_))
  , is_tcp_(is_tcp_)
{}

const std::int32_t callServerTypeTelegramReflector::ID;

object_ptr<CallServerType> callServerTypeTelegramReflector::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<callServerTypeTelegramReflector> res = make_object<callServerTypeTelegramReflector>();
  res->peer_tag_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->peer_tag_fieldID));
  res->is_tcp_ = (env->GetBooleanField(p, res->is_tcp_fieldID) != 0);
  return std::move(res);
}

void callServerTypeTelegramReflector::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jbyteArray nextBytes = jni::to_bytes(env, peer_tag_); if (nextBytes) { env->SetObjectField(s, peer_tag_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  env->SetBooleanField(s, is_tcp_fieldID, is_tcp_);
}

void callServerTypeTelegramReflector::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CallServerTypeTelegramReflector");
    s.store_bytes_field("peerTag", peer_tag_);
    s.store_field("isTcp", is_tcp_);
    s.store_class_end();
  }
}

void callServerTypeTelegramReflector::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CallServerTypeTelegramReflector").c_str());
    peer_tag_fieldID = jni::get_field_id(env, Class, "peerTag", "[B");
    is_tcp_fieldID = jni::get_field_id(env, Class, "isTcp", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass callServerTypeWebrtc::Class;
jfieldID callServerTypeWebrtc::username_fieldID;
jfieldID callServerTypeWebrtc::password_fieldID;
jfieldID callServerTypeWebrtc::supports_turn_fieldID;
jfieldID callServerTypeWebrtc::supports_stun_fieldID;

callServerTypeWebrtc::callServerTypeWebrtc()
  : username_()
  , password_()
  , supports_turn_()
  , supports_stun_()
{}

callServerTypeWebrtc::callServerTypeWebrtc(string const &username_, string const &password_, bool supports_turn_, bool supports_stun_)
  : username_(username_)
  , password_(password_)
  , supports_turn_(supports_turn_)
  , supports_stun_(supports_stun_)
{}

const std::int32_t callServerTypeWebrtc::ID;

object_ptr<CallServerType> callServerTypeWebrtc::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<callServerTypeWebrtc> res = make_object<callServerTypeWebrtc>();
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  res->supports_turn_ = (env->GetBooleanField(p, res->supports_turn_fieldID) != 0);
  res->supports_stun_ = (env->GetBooleanField(p, res->supports_stun_fieldID) != 0);
  return std::move(res);
}

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

void callServerTypeWebrtc::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CallServerTypeWebrtc");
    s.store_field("username", username_);
    s.store_field("password", password_);
    s.store_field("supportsTurn", supports_turn_);
    s.store_field("supportsStun", supports_stun_);
    s.store_class_end();
  }
}

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

jclass CanSendMessageToUserResult::Class;

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

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

jclass canSendMessageToUserResultOk::Class;

canSendMessageToUserResultOk::canSendMessageToUserResultOk() {
}

const std::int32_t canSendMessageToUserResultOk::ID;

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

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

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

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

jclass canSendMessageToUserResultUserHasPaidMessages::Class;
jfieldID canSendMessageToUserResultUserHasPaidMessages::outgoing_paid_message_star_count_fieldID;

canSendMessageToUserResultUserHasPaidMessages::canSendMessageToUserResultUserHasPaidMessages()
  : outgoing_paid_message_star_count_()
{}

canSendMessageToUserResultUserHasPaidMessages::canSendMessageToUserResultUserHasPaidMessages(int53 outgoing_paid_message_star_count_)
  : outgoing_paid_message_star_count_(outgoing_paid_message_star_count_)
{}

const std::int32_t canSendMessageToUserResultUserHasPaidMessages::ID;

object_ptr<CanSendMessageToUserResult> canSendMessageToUserResultUserHasPaidMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<canSendMessageToUserResultUserHasPaidMessages> res = make_object<canSendMessageToUserResultUserHasPaidMessages>();
  res->outgoing_paid_message_star_count_ = env->GetLongField(p, res->outgoing_paid_message_star_count_fieldID);
  return std::move(res);
}

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

void canSendMessageToUserResultUserHasPaidMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanSendMessageToUserResultUserHasPaidMessages");
    s.store_field("outgoingPaidMessageStarCount", outgoing_paid_message_star_count_);
    s.store_class_end();
  }
}

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

jclass canSendMessageToUserResultUserIsDeleted::Class;

canSendMessageToUserResultUserIsDeleted::canSendMessageToUserResultUserIsDeleted() {
}

const std::int32_t canSendMessageToUserResultUserIsDeleted::ID;

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

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

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

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

jclass canSendMessageToUserResultUserRestrictsNewChats::Class;

canSendMessageToUserResultUserRestrictsNewChats::canSendMessageToUserResultUserRestrictsNewChats() {
}

const std::int32_t canSendMessageToUserResultUserRestrictsNewChats::ID;

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

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

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

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

jclass chatActiveStories::Class;
jfieldID chatActiveStories::chat_id_fieldID;
jfieldID chatActiveStories::list_fieldID;
jfieldID chatActiveStories::order_fieldID;
jfieldID chatActiveStories::can_be_archived_fieldID;
jfieldID chatActiveStories::max_read_story_id_fieldID;
jfieldID chatActiveStories::stories_fieldID;

chatActiveStories::chatActiveStories()
  : chat_id_()
  , list_()
  , order_()
  , can_be_archived_()
  , max_read_story_id_()
  , stories_()
{}

chatActiveStories::chatActiveStories(int53 chat_id_, object_ptr<StoryList> &&list_, int53 order_, bool can_be_archived_, int32 max_read_story_id_, array<object_ptr<storyInfo>> &&stories_)
  : chat_id_(chat_id_)
  , list_(std::move(list_))
  , order_(order_)
  , can_be_archived_(can_be_archived_)
  , max_read_story_id_(max_read_story_id_)
  , stories_(std::move(stories_))
{}

const std::int32_t chatActiveStories::ID;

object_ptr<chatActiveStories> chatActiveStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatActiveStories> res = make_object<chatActiveStories>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->list_ = jni::fetch_tl_object<StoryList>(env, jni::fetch_object(env, p, res->list_fieldID));
  res->order_ = env->GetLongField(p, res->order_fieldID);
  res->can_be_archived_ = (env->GetBooleanField(p, res->can_be_archived_fieldID) != 0);
  res->max_read_story_id_ = env->GetIntField(p, res->max_read_story_id_fieldID);
  res->stories_ = jni::FetchVector<storyInfo>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->stories_fieldID));
  return res;
}

void chatActiveStories::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 (list_ != nullptr) { jobject next; list_->store(env, next); if (next) { env->SetObjectField(s, list_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetLongField(s, order_fieldID, order_);
  env->SetBooleanField(s, can_be_archived_fieldID, can_be_archived_);
  env->SetIntField(s, max_read_story_id_fieldID, max_read_story_id_);
  { auto arr_tmp_ = jni::store_vector(env, stories_); if (arr_tmp_) { env->SetObjectField(s, stories_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void chatActiveStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatActiveStories");
    s.store_field("chatId", chat_id_);
    s.store_object_field("list", static_cast<const BaseObject *>(list_.get()));
    s.store_field("order", order_);
    s.store_field("canBeArchived", can_be_archived_);
    s.store_field("maxReadStoryId", max_read_story_id_);
    { s.store_vector_begin("stories", stories_.size()); for (const auto &_value : stories_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void chatActiveStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatActiveStories").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    list_fieldID = jni::get_field_id(env, Class, "list", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryList;").c_str());
    order_fieldID = jni::get_field_id(env, Class, "order", "J");
    can_be_archived_fieldID = jni::get_field_id(env, Class, "canBeArchived", "Z");
    max_read_story_id_fieldID = jni::get_field_id(env, Class, "maxReadStoryId", "I");
    stories_fieldID = jni::get_field_id(env, Class, "stories", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$StoryInfo;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatFolderInviteLink::Class;
jfieldID chatFolderInviteLink::invite_link_fieldID;
jfieldID chatFolderInviteLink::name_fieldID;
jfieldID chatFolderInviteLink::chat_ids_fieldID;

chatFolderInviteLink::chatFolderInviteLink()
  : invite_link_()
  , name_()
  , chat_ids_()
{}

chatFolderInviteLink::chatFolderInviteLink(string const &invite_link_, string const &name_, array<int53> &&chat_ids_)
  : invite_link_(invite_link_)
  , name_(name_)
  , chat_ids_(std::move(chat_ids_))
{}

const std::int32_t chatFolderInviteLink::ID;

object_ptr<chatFolderInviteLink> chatFolderInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatFolderInviteLink> res = make_object<chatFolderInviteLink>();
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  return res;
}

void chatFolderInviteLink::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, invite_link_); if (nextString) { env->SetObjectField(s, invite_link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { auto arr_tmp_ = jni::store_vector(env, chat_ids_); if (arr_tmp_) { env->SetObjectField(s, chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void chatFolderInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatFolderInviteLink");
    s.store_field("inviteLink", invite_link_);
    s.store_field("name", name_);
    { s.store_vector_begin("chatIds", chat_ids_.size()); for (const auto &_value : chat_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass chatInviteLinkCounts::Class;
jfieldID chatInviteLinkCounts::invite_link_counts_fieldID;

chatInviteLinkCounts::chatInviteLinkCounts()
  : invite_link_counts_()
{}

chatInviteLinkCounts::chatInviteLinkCounts(array<object_ptr<chatInviteLinkCount>> &&invite_link_counts_)
  : invite_link_counts_(std::move(invite_link_counts_))
{}

const std::int32_t chatInviteLinkCounts::ID;

object_ptr<chatInviteLinkCounts> chatInviteLinkCounts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatInviteLinkCounts> res = make_object<chatInviteLinkCounts>();
  res->invite_link_counts_ = jni::FetchVector<chatInviteLinkCount>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->invite_link_counts_fieldID));
  return res;
}

void chatInviteLinkCounts::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_link_counts_); if (arr_tmp_) { env->SetObjectField(s, invite_link_counts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

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

jclass ChatPhotoStickerType::Class;

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

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

jclass chatPhotoStickerTypeRegularOrMask::Class;
jfieldID chatPhotoStickerTypeRegularOrMask::sticker_set_id_fieldID;
jfieldID chatPhotoStickerTypeRegularOrMask::sticker_id_fieldID;

chatPhotoStickerTypeRegularOrMask::chatPhotoStickerTypeRegularOrMask()
  : sticker_set_id_()
  , sticker_id_()
{}

chatPhotoStickerTypeRegularOrMask::chatPhotoStickerTypeRegularOrMask(int64 sticker_set_id_, int64 sticker_id_)
  : sticker_set_id_(sticker_set_id_)
  , sticker_id_(sticker_id_)
{}

const std::int32_t chatPhotoStickerTypeRegularOrMask::ID;

object_ptr<ChatPhotoStickerType> chatPhotoStickerTypeRegularOrMask::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatPhotoStickerTypeRegularOrMask> res = make_object<chatPhotoStickerTypeRegularOrMask>();
  res->sticker_set_id_ = env->GetLongField(p, res->sticker_set_id_fieldID);
  res->sticker_id_ = env->GetLongField(p, res->sticker_id_fieldID);
  return std::move(res);
}

void chatPhotoStickerTypeRegularOrMask::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, sticker_set_id_fieldID, sticker_set_id_);
  env->SetLongField(s, sticker_id_fieldID, sticker_id_);
}

void chatPhotoStickerTypeRegularOrMask::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatPhotoStickerTypeRegularOrMask");
    s.store_field("stickerSetId", sticker_set_id_);
    s.store_field("stickerId", sticker_id_);
    s.store_class_end();
  }
}

void chatPhotoStickerTypeRegularOrMask::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatPhotoStickerTypeRegularOrMask").c_str());
    sticker_set_id_fieldID = jni::get_field_id(env, Class, "stickerSetId", "J");
    sticker_id_fieldID = jni::get_field_id(env, Class, "stickerId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatPhotoStickerTypeCustomEmoji::Class;
jfieldID chatPhotoStickerTypeCustomEmoji::custom_emoji_id_fieldID;

chatPhotoStickerTypeCustomEmoji::chatPhotoStickerTypeCustomEmoji()
  : custom_emoji_id_()
{}

chatPhotoStickerTypeCustomEmoji::chatPhotoStickerTypeCustomEmoji(int64 custom_emoji_id_)
  : custom_emoji_id_(custom_emoji_id_)
{}

const std::int32_t chatPhotoStickerTypeCustomEmoji::ID;

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

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

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

jclass chatRevenueStatistics::Class;
jfieldID chatRevenueStatistics::revenue_by_hour_graph_fieldID;
jfieldID chatRevenueStatistics::revenue_graph_fieldID;
jfieldID chatRevenueStatistics::revenue_amount_fieldID;
jfieldID chatRevenueStatistics::usd_rate_fieldID;

chatRevenueStatistics::chatRevenueStatistics()
  : revenue_by_hour_graph_()
  , revenue_graph_()
  , revenue_amount_()
  , usd_rate_()
{}

chatRevenueStatistics::chatRevenueStatistics(object_ptr<StatisticalGraph> &&revenue_by_hour_graph_, object_ptr<StatisticalGraph> &&revenue_graph_, object_ptr<chatRevenueAmount> &&revenue_amount_, double usd_rate_)
  : revenue_by_hour_graph_(std::move(revenue_by_hour_graph_))
  , revenue_graph_(std::move(revenue_graph_))
  , revenue_amount_(std::move(revenue_amount_))
  , usd_rate_(usd_rate_)
{}

const std::int32_t chatRevenueStatistics::ID;

object_ptr<chatRevenueStatistics> chatRevenueStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatRevenueStatistics> res = make_object<chatRevenueStatistics>();
  res->revenue_by_hour_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->revenue_by_hour_graph_fieldID));
  res->revenue_graph_ = jni::fetch_tl_object<StatisticalGraph>(env, jni::fetch_object(env, p, res->revenue_graph_fieldID));
  res->revenue_amount_ = jni::fetch_tl_object<chatRevenueAmount>(env, jni::fetch_object(env, p, res->revenue_amount_fieldID));
  res->usd_rate_ = env->GetDoubleField(p, res->usd_rate_fieldID);
  return res;
}

void chatRevenueStatistics::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (revenue_by_hour_graph_ != nullptr) { jobject next; revenue_by_hour_graph_->store(env, next); if (next) { env->SetObjectField(s, revenue_by_hour_graph_fieldID, next); env->DeleteLocalRef(next); } }
  if (revenue_graph_ != nullptr) { jobject next; revenue_graph_->store(env, next); if (next) { env->SetObjectField(s, revenue_graph_fieldID, next); env->DeleteLocalRef(next); } }
  if (revenue_amount_ != nullptr) { jobject next; revenue_amount_->store(env, next); if (next) { env->SetObjectField(s, revenue_amount_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetDoubleField(s, usd_rate_fieldID, usd_rate_);
}

void chatRevenueStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatRevenueStatistics");
    s.store_object_field("revenueByHourGraph", static_cast<const BaseObject *>(revenue_by_hour_graph_.get()));
    s.store_object_field("revenueGraph", static_cast<const BaseObject *>(revenue_graph_.get()));
    s.store_object_field("revenueAmount", static_cast<const BaseObject *>(revenue_amount_.get()));
    s.store_field("usdRate", usd_rate_);
    s.store_class_end();
  }
}

void chatRevenueStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatRevenueStatistics").c_str());
    revenue_by_hour_graph_fieldID = jni::get_field_id(env, Class, "revenueByHourGraph", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StatisticalGraph;").c_str());
    revenue_graph_fieldID = jni::get_field_id(env, Class, "revenueGraph", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StatisticalGraph;").c_str());
    revenue_amount_fieldID = jni::get_field_id(env, Class, "revenueAmount", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatRevenueAmount;").c_str());
    usd_rate_fieldID = jni::get_field_id(env, Class, "usdRate", "D");
    return true;
  }();
  (void)is_inited;
}

jclass chatStatisticsAdministratorActionsInfo::Class;
jfieldID chatStatisticsAdministratorActionsInfo::user_id_fieldID;
jfieldID chatStatisticsAdministratorActionsInfo::deleted_message_count_fieldID;
jfieldID chatStatisticsAdministratorActionsInfo::banned_user_count_fieldID;
jfieldID chatStatisticsAdministratorActionsInfo::restricted_user_count_fieldID;

chatStatisticsAdministratorActionsInfo::chatStatisticsAdministratorActionsInfo()
  : user_id_()
  , deleted_message_count_()
  , banned_user_count_()
  , restricted_user_count_()
{}

chatStatisticsAdministratorActionsInfo::chatStatisticsAdministratorActionsInfo(int53 user_id_, int32 deleted_message_count_, int32 banned_user_count_, int32 restricted_user_count_)
  : user_id_(user_id_)
  , deleted_message_count_(deleted_message_count_)
  , banned_user_count_(banned_user_count_)
  , restricted_user_count_(restricted_user_count_)
{}

const std::int32_t chatStatisticsAdministratorActionsInfo::ID;

object_ptr<chatStatisticsAdministratorActionsInfo> chatStatisticsAdministratorActionsInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatStatisticsAdministratorActionsInfo> res = make_object<chatStatisticsAdministratorActionsInfo>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->deleted_message_count_ = env->GetIntField(p, res->deleted_message_count_fieldID);
  res->banned_user_count_ = env->GetIntField(p, res->banned_user_count_fieldID);
  res->restricted_user_count_ = env->GetIntField(p, res->restricted_user_count_fieldID);
  return res;
}

void chatStatisticsAdministratorActionsInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, user_id_fieldID, user_id_);
  env->SetIntField(s, deleted_message_count_fieldID, deleted_message_count_);
  env->SetIntField(s, banned_user_count_fieldID, banned_user_count_);
  env->SetIntField(s, restricted_user_count_fieldID, restricted_user_count_);
}

void chatStatisticsAdministratorActionsInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatStatisticsAdministratorActionsInfo");
    s.store_field("userId", user_id_);
    s.store_field("deletedMessageCount", deleted_message_count_);
    s.store_field("bannedUserCount", banned_user_count_);
    s.store_field("restrictedUserCount", restricted_user_count_);
    s.store_class_end();
  }
}

void chatStatisticsAdministratorActionsInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatStatisticsAdministratorActionsInfo").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    deleted_message_count_fieldID = jni::get_field_id(env, Class, "deletedMessageCount", "I");
    banned_user_count_fieldID = jni::get_field_id(env, Class, "bannedUserCount", "I");
    restricted_user_count_fieldID = jni::get_field_id(env, Class, "restrictedUserCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass CheckChatUsernameResult::Class;

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

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

jclass checkChatUsernameResultOk::Class;

checkChatUsernameResultOk::checkChatUsernameResultOk() {
}

const std::int32_t checkChatUsernameResultOk::ID;

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

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

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

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

jclass checkChatUsernameResultUsernameInvalid::Class;

checkChatUsernameResultUsernameInvalid::checkChatUsernameResultUsernameInvalid() {
}

const std::int32_t checkChatUsernameResultUsernameInvalid::ID;

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

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

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

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

jclass checkChatUsernameResultUsernameOccupied::Class;

checkChatUsernameResultUsernameOccupied::checkChatUsernameResultUsernameOccupied() {
}

const std::int32_t checkChatUsernameResultUsernameOccupied::ID;

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

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

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

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

jclass checkChatUsernameResultUsernamePurchasable::Class;

checkChatUsernameResultUsernamePurchasable::checkChatUsernameResultUsernamePurchasable() {
}

const std::int32_t checkChatUsernameResultUsernamePurchasable::ID;

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

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

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

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

jclass checkChatUsernameResultPublicChatsTooMany::Class;

checkChatUsernameResultPublicChatsTooMany::checkChatUsernameResultPublicChatsTooMany() {
}

const std::int32_t checkChatUsernameResultPublicChatsTooMany::ID;

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

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

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

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

jclass checkChatUsernameResultPublicGroupsUnavailable::Class;

checkChatUsernameResultPublicGroupsUnavailable::checkChatUsernameResultPublicGroupsUnavailable() {
}

const std::int32_t checkChatUsernameResultPublicGroupsUnavailable::ID;

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

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

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

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

jclass data::Class;
jfieldID data::data_fieldID;

data::data()
  : data_()
{}

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

const std::int32_t data::ID;

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

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

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

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

jclass DeviceToken::Class;

object_ptr<DeviceToken> DeviceToken::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case deviceTokenFirebaseCloudMessaging::ID:
      return deviceTokenFirebaseCloudMessaging::fetch(env, p);
    case deviceTokenApplePush::ID:
      return deviceTokenApplePush::fetch(env, p);
    case deviceTokenApplePushVoIP::ID:
      return deviceTokenApplePushVoIP::fetch(env, p);
    case deviceTokenWindowsPush::ID:
      return deviceTokenWindowsPush::fetch(env, p);
    case deviceTokenMicrosoftPush::ID:
      return deviceTokenMicrosoftPush::fetch(env, p);
    case deviceTokenMicrosoftPushVoIP::ID:
      return deviceTokenMicrosoftPushVoIP::fetch(env, p);
    case deviceTokenWebPush::ID:
      return deviceTokenWebPush::fetch(env, p);
    case deviceTokenSimplePush::ID:
      return deviceTokenSimplePush::fetch(env, p);
    case deviceTokenUbuntuPush::ID:
      return deviceTokenUbuntuPush::fetch(env, p);
    case deviceTokenBlackBerryPush::ID:
      return deviceTokenBlackBerryPush::fetch(env, p);
    case deviceTokenTizenPush::ID:
      return deviceTokenTizenPush::fetch(env, p);
    case deviceTokenHuaweiPush::ID:
      return deviceTokenHuaweiPush::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass deviceTokenFirebaseCloudMessaging::Class;
jfieldID deviceTokenFirebaseCloudMessaging::token_fieldID;
jfieldID deviceTokenFirebaseCloudMessaging::encrypt_fieldID;

deviceTokenFirebaseCloudMessaging::deviceTokenFirebaseCloudMessaging()
  : token_()
  , encrypt_()
{}

deviceTokenFirebaseCloudMessaging::deviceTokenFirebaseCloudMessaging(string const &token_, bool encrypt_)
  : token_(token_)
  , encrypt_(encrypt_)
{}

const std::int32_t deviceTokenFirebaseCloudMessaging::ID;

object_ptr<DeviceToken> deviceTokenFirebaseCloudMessaging::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenFirebaseCloudMessaging> res = make_object<deviceTokenFirebaseCloudMessaging>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  res->encrypt_ = (env->GetBooleanField(p, res->encrypt_fieldID) != 0);
  return std::move(res);
}

void deviceTokenFirebaseCloudMessaging::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenFirebaseCloudMessaging");
    s.store_field("token", token_);
    s.store_field("encrypt", encrypt_);
    s.store_class_end();
  }
}

void deviceTokenFirebaseCloudMessaging::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeviceTokenFirebaseCloudMessaging").c_str());
    token_fieldID = jni::get_field_id(env, Class, "token", "Ljava/lang/String;");
    encrypt_fieldID = jni::get_field_id(env, Class, "encrypt", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass deviceTokenApplePush::Class;
jfieldID deviceTokenApplePush::device_token_fieldID;
jfieldID deviceTokenApplePush::is_app_sandbox_fieldID;

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

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

const std::int32_t deviceTokenApplePush::ID;

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

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

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

jclass deviceTokenApplePushVoIP::Class;
jfieldID deviceTokenApplePushVoIP::device_token_fieldID;
jfieldID deviceTokenApplePushVoIP::is_app_sandbox_fieldID;
jfieldID deviceTokenApplePushVoIP::encrypt_fieldID;

deviceTokenApplePushVoIP::deviceTokenApplePushVoIP()
  : device_token_()
  , is_app_sandbox_()
  , encrypt_()
{}

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

const std::int32_t deviceTokenApplePushVoIP::ID;

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

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

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

jclass deviceTokenWindowsPush::Class;
jfieldID deviceTokenWindowsPush::access_token_fieldID;

deviceTokenWindowsPush::deviceTokenWindowsPush()
  : access_token_()
{}

deviceTokenWindowsPush::deviceTokenWindowsPush(string const &access_token_)
  : access_token_(access_token_)
{}

const std::int32_t deviceTokenWindowsPush::ID;

object_ptr<DeviceToken> deviceTokenWindowsPush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenWindowsPush> res = make_object<deviceTokenWindowsPush>();
  res->access_token_ = jni::fetch_string(env, p, res->access_token_fieldID);
  return std::move(res);
}

void deviceTokenWindowsPush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenWindowsPush");
    s.store_field("accessToken", access_token_);
    s.store_class_end();
  }
}

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

jclass deviceTokenMicrosoftPush::Class;
jfieldID deviceTokenMicrosoftPush::channel_uri_fieldID;

deviceTokenMicrosoftPush::deviceTokenMicrosoftPush()
  : channel_uri_()
{}

deviceTokenMicrosoftPush::deviceTokenMicrosoftPush(string const &channel_uri_)
  : channel_uri_(channel_uri_)
{}

const std::int32_t deviceTokenMicrosoftPush::ID;

object_ptr<DeviceToken> deviceTokenMicrosoftPush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenMicrosoftPush> res = make_object<deviceTokenMicrosoftPush>();
  res->channel_uri_ = jni::fetch_string(env, p, res->channel_uri_fieldID);
  return std::move(res);
}

void deviceTokenMicrosoftPush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenMicrosoftPush");
    s.store_field("channelUri", channel_uri_);
    s.store_class_end();
  }
}

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

jclass deviceTokenMicrosoftPushVoIP::Class;
jfieldID deviceTokenMicrosoftPushVoIP::channel_uri_fieldID;

deviceTokenMicrosoftPushVoIP::deviceTokenMicrosoftPushVoIP()
  : channel_uri_()
{}

deviceTokenMicrosoftPushVoIP::deviceTokenMicrosoftPushVoIP(string const &channel_uri_)
  : channel_uri_(channel_uri_)
{}

const std::int32_t deviceTokenMicrosoftPushVoIP::ID;

object_ptr<DeviceToken> deviceTokenMicrosoftPushVoIP::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenMicrosoftPushVoIP> res = make_object<deviceTokenMicrosoftPushVoIP>();
  res->channel_uri_ = jni::fetch_string(env, p, res->channel_uri_fieldID);
  return std::move(res);
}

void deviceTokenMicrosoftPushVoIP::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenMicrosoftPushVoIP");
    s.store_field("channelUri", channel_uri_);
    s.store_class_end();
  }
}

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

jclass deviceTokenWebPush::Class;
jfieldID deviceTokenWebPush::endpoint_fieldID;
jfieldID deviceTokenWebPush::p256dh_base64url_fieldID;
jfieldID deviceTokenWebPush::auth_base64url_fieldID;

deviceTokenWebPush::deviceTokenWebPush()
  : endpoint_()
  , p256dh_base64url_()
  , auth_base64url_()
{}

deviceTokenWebPush::deviceTokenWebPush(string const &endpoint_, string const &p256dh_base64url_, string const &auth_base64url_)
  : endpoint_(endpoint_)
  , p256dh_base64url_(p256dh_base64url_)
  , auth_base64url_(auth_base64url_)
{}

const std::int32_t deviceTokenWebPush::ID;

object_ptr<DeviceToken> deviceTokenWebPush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenWebPush> res = make_object<deviceTokenWebPush>();
  res->endpoint_ = jni::fetch_string(env, p, res->endpoint_fieldID);
  res->p256dh_base64url_ = jni::fetch_string(env, p, res->p256dh_base64url_fieldID);
  res->auth_base64url_ = jni::fetch_string(env, p, res->auth_base64url_fieldID);
  return std::move(res);
}

void deviceTokenWebPush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenWebPush");
    s.store_field("endpoint", endpoint_);
    s.store_field("p256dhBase64url", p256dh_base64url_);
    s.store_field("authBase64url", auth_base64url_);
    s.store_class_end();
  }
}

void deviceTokenWebPush::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeviceTokenWebPush").c_str());
    endpoint_fieldID = jni::get_field_id(env, Class, "endpoint", "Ljava/lang/String;");
    p256dh_base64url_fieldID = jni::get_field_id(env, Class, "p256dhBase64url", "Ljava/lang/String;");
    auth_base64url_fieldID = jni::get_field_id(env, Class, "authBase64url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass deviceTokenSimplePush::Class;
jfieldID deviceTokenSimplePush::endpoint_fieldID;

deviceTokenSimplePush::deviceTokenSimplePush()
  : endpoint_()
{}

deviceTokenSimplePush::deviceTokenSimplePush(string const &endpoint_)
  : endpoint_(endpoint_)
{}

const std::int32_t deviceTokenSimplePush::ID;

object_ptr<DeviceToken> deviceTokenSimplePush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenSimplePush> res = make_object<deviceTokenSimplePush>();
  res->endpoint_ = jni::fetch_string(env, p, res->endpoint_fieldID);
  return std::move(res);
}

void deviceTokenSimplePush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenSimplePush");
    s.store_field("endpoint", endpoint_);
    s.store_class_end();
  }
}

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

jclass deviceTokenUbuntuPush::Class;
jfieldID deviceTokenUbuntuPush::token_fieldID;

deviceTokenUbuntuPush::deviceTokenUbuntuPush()
  : token_()
{}

deviceTokenUbuntuPush::deviceTokenUbuntuPush(string const &token_)
  : token_(token_)
{}

const std::int32_t deviceTokenUbuntuPush::ID;

object_ptr<DeviceToken> deviceTokenUbuntuPush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenUbuntuPush> res = make_object<deviceTokenUbuntuPush>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  return std::move(res);
}

void deviceTokenUbuntuPush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenUbuntuPush");
    s.store_field("token", token_);
    s.store_class_end();
  }
}

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

jclass deviceTokenBlackBerryPush::Class;
jfieldID deviceTokenBlackBerryPush::token_fieldID;

deviceTokenBlackBerryPush::deviceTokenBlackBerryPush()
  : token_()
{}

deviceTokenBlackBerryPush::deviceTokenBlackBerryPush(string const &token_)
  : token_(token_)
{}

const std::int32_t deviceTokenBlackBerryPush::ID;

object_ptr<DeviceToken> deviceTokenBlackBerryPush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenBlackBerryPush> res = make_object<deviceTokenBlackBerryPush>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  return std::move(res);
}

void deviceTokenBlackBerryPush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenBlackBerryPush");
    s.store_field("token", token_);
    s.store_class_end();
  }
}

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

jclass deviceTokenTizenPush::Class;
jfieldID deviceTokenTizenPush::reg_id_fieldID;

deviceTokenTizenPush::deviceTokenTizenPush()
  : reg_id_()
{}

deviceTokenTizenPush::deviceTokenTizenPush(string const &reg_id_)
  : reg_id_(reg_id_)
{}

const std::int32_t deviceTokenTizenPush::ID;

object_ptr<DeviceToken> deviceTokenTizenPush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenTizenPush> res = make_object<deviceTokenTizenPush>();
  res->reg_id_ = jni::fetch_string(env, p, res->reg_id_fieldID);
  return std::move(res);
}

void deviceTokenTizenPush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenTizenPush");
    s.store_field("regId", reg_id_);
    s.store_class_end();
  }
}

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

jclass deviceTokenHuaweiPush::Class;
jfieldID deviceTokenHuaweiPush::token_fieldID;
jfieldID deviceTokenHuaweiPush::encrypt_fieldID;

deviceTokenHuaweiPush::deviceTokenHuaweiPush()
  : token_()
  , encrypt_()
{}

deviceTokenHuaweiPush::deviceTokenHuaweiPush(string const &token_, bool encrypt_)
  : token_(token_)
  , encrypt_(encrypt_)
{}

const std::int32_t deviceTokenHuaweiPush::ID;

object_ptr<DeviceToken> deviceTokenHuaweiPush::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deviceTokenHuaweiPush> res = make_object<deviceTokenHuaweiPush>();
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  res->encrypt_ = (env->GetBooleanField(p, res->encrypt_fieldID) != 0);
  return std::move(res);
}

void deviceTokenHuaweiPush::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeviceTokenHuaweiPush");
    s.store_field("token", token_);
    s.store_field("encrypt", encrypt_);
    s.store_class_end();
  }
}

void deviceTokenHuaweiPush::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DeviceTokenHuaweiPush").c_str());
    token_fieldID = jni::get_field_id(env, Class, "token", "Ljava/lang/String;");
    encrypt_fieldID = jni::get_field_id(env, Class, "encrypt", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass diffText::Class;
jfieldID diffText::text_fieldID;
jfieldID diffText::entities_fieldID;

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

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

const std::int32_t diffText::ID;

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

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

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

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

jclass emojiCategory::Class;
jfieldID emojiCategory::name_fieldID;
jfieldID emojiCategory::icon_fieldID;
jfieldID emojiCategory::source_fieldID;
jfieldID emojiCategory::is_greeting_fieldID;

emojiCategory::emojiCategory()
  : name_()
  , icon_()
  , source_()
  , is_greeting_()
{}

emojiCategory::emojiCategory(string const &name_, object_ptr<sticker> &&icon_, object_ptr<EmojiCategorySource> &&source_, bool is_greeting_)
  : name_(name_)
  , icon_(std::move(icon_))
  , source_(std::move(source_))
  , is_greeting_(is_greeting_)
{}

const std::int32_t emojiCategory::ID;

object_ptr<emojiCategory> emojiCategory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiCategory> res = make_object<emojiCategory>();
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->icon_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->icon_fieldID));
  res->source_ = jni::fetch_tl_object<EmojiCategorySource>(env, jni::fetch_object(env, p, res->source_fieldID));
  res->is_greeting_ = (env->GetBooleanField(p, res->is_greeting_fieldID) != 0);
  return res;
}

void emojiCategory::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (icon_ != nullptr) { jobject next; icon_->store(env, next); if (next) { env->SetObjectField(s, icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (source_ != nullptr) { jobject next; source_->store(env, next); if (next) { env->SetObjectField(s, source_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_greeting_fieldID, is_greeting_);
}

void emojiCategory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EmojiCategory");
    s.store_field("name", name_);
    s.store_object_field("icon", static_cast<const BaseObject *>(icon_.get()));
    s.store_object_field("source", static_cast<const BaseObject *>(source_.get()));
    s.store_field("isGreeting", is_greeting_);
    s.store_class_end();
  }
}

void emojiCategory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EmojiCategory").c_str());
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    icon_fieldID = jni::get_field_id(env, Class, "icon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    source_fieldID = jni::get_field_id(env, Class, "source", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$EmojiCategorySource;").c_str());
    is_greeting_fieldID = jni::get_field_id(env, Class, "isGreeting", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass game::Class;
jfieldID game::id_fieldID;
jfieldID game::short_name_fieldID;
jfieldID game::title_fieldID;
jfieldID game::text_fieldID;
jfieldID game::description_fieldID;
jfieldID game::photo_fieldID;
jfieldID game::animation_fieldID;

game::game()
  : id_()
  , short_name_()
  , title_()
  , text_()
  , description_()
  , photo_()
  , animation_()
{}

game::game(int64 id_, string const &short_name_, string const &title_, object_ptr<formattedText> &&text_, string const &description_, object_ptr<photo> &&photo_, object_ptr<animation> &&animation_)
  : id_(id_)
  , short_name_(short_name_)
  , title_(title_)
  , text_(std::move(text_))
  , description_(description_)
  , photo_(std::move(photo_))
  , animation_(std::move(animation_))
{}

const std::int32_t game::ID;

object_ptr<game> game::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<game> res = make_object<game>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->short_name_ = jni::fetch_string(env, p, res->short_name_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->description_ = jni::fetch_string(env, p, res->description_fieldID);
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  return res;
}

void game::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, short_name_); if (nextString) { env->SetObjectField(s, short_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, description_); if (nextString) { env->SetObjectField(s, description_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
}

void game::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Game");
    s.store_field("id", id_);
    s.store_field("shortName", short_name_);
    s.store_field("title", title_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("description", description_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_class_end();
  }
}

void game::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Game").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    short_name_fieldID = jni::get_field_id(env, Class, "shortName", "Ljava/lang/String;");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    description_fieldID = jni::get_field_id(env, Class, "description", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Animation;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass giftCollection::Class;
jfieldID giftCollection::id_fieldID;
jfieldID giftCollection::name_fieldID;
jfieldID giftCollection::icon_fieldID;
jfieldID giftCollection::gift_count_fieldID;

giftCollection::giftCollection()
  : id_()
  , name_()
  , icon_()
  , gift_count_()
{}

giftCollection::giftCollection(int32 id_, string const &name_, object_ptr<sticker> &&icon_, int32 gift_count_)
  : id_(id_)
  , name_(name_)
  , icon_(std::move(icon_))
  , gift_count_(gift_count_)
{}

const std::int32_t giftCollection::ID;

object_ptr<giftCollection> giftCollection::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftCollection> res = make_object<giftCollection>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->icon_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->icon_fieldID));
  res->gift_count_ = env->GetIntField(p, res->gift_count_fieldID);
  return res;
}

void giftCollection::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (icon_ != nullptr) { jobject next; icon_->store(env, next); if (next) { env->SetObjectField(s, icon_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, gift_count_fieldID, gift_count_);
}

void giftCollection::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftCollection");
    s.store_field("id", id_);
    s.store_field("name", name_);
    s.store_object_field("icon", static_cast<const BaseObject *>(icon_.get()));
    s.store_field("giftCount", gift_count_);
    s.store_class_end();
  }
}

void giftCollection::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftCollection").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    icon_fieldID = jni::get_field_id(env, Class, "icon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    gift_count_fieldID = jni::get_field_id(env, Class, "giftCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass GiftForResaleOrder::Class;

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

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

jclass giftForResaleOrderPrice::Class;

giftForResaleOrderPrice::giftForResaleOrderPrice() {
}

const std::int32_t giftForResaleOrderPrice::ID;

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

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

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

jclass giftForResaleOrderPriceChangeDate::Class;

giftForResaleOrderPriceChangeDate::giftForResaleOrderPriceChangeDate() {
}

const std::int32_t giftForResaleOrderPriceChangeDate::ID;

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

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

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

jclass giftForResaleOrderNumber::Class;

giftForResaleOrderNumber::giftForResaleOrderNumber() {
}

const std::int32_t giftForResaleOrderNumber::ID;

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

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

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

jclass giftPurchaseLimits::Class;
jfieldID giftPurchaseLimits::total_count_fieldID;
jfieldID giftPurchaseLimits::remaining_count_fieldID;

giftPurchaseLimits::giftPurchaseLimits()
  : total_count_()
  , remaining_count_()
{}

giftPurchaseLimits::giftPurchaseLimits(int32 total_count_, int32 remaining_count_)
  : total_count_(total_count_)
  , remaining_count_(remaining_count_)
{}

const std::int32_t giftPurchaseLimits::ID;

object_ptr<giftPurchaseLimits> giftPurchaseLimits::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftPurchaseLimits> res = make_object<giftPurchaseLimits>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->remaining_count_ = env->GetIntField(p, res->remaining_count_fieldID);
  return res;
}

void giftPurchaseLimits::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, total_count_fieldID, total_count_);
  env->SetIntField(s, remaining_count_fieldID, remaining_count_);
}

void giftPurchaseLimits::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftPurchaseLimits");
    s.store_field("totalCount", total_count_);
    s.store_field("remainingCount", remaining_count_);
    s.store_class_end();
  }
}

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

jclass giftSettings::Class;
jfieldID giftSettings::show_gift_button_fieldID;
jfieldID giftSettings::accepted_gift_types_fieldID;

giftSettings::giftSettings()
  : show_gift_button_()
  , accepted_gift_types_()
{}

giftSettings::giftSettings(bool show_gift_button_, object_ptr<acceptedGiftTypes> &&accepted_gift_types_)
  : show_gift_button_(show_gift_button_)
  , accepted_gift_types_(std::move(accepted_gift_types_))
{}

const std::int32_t giftSettings::ID;

object_ptr<giftSettings> giftSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftSettings> res = make_object<giftSettings>();
  res->show_gift_button_ = (env->GetBooleanField(p, res->show_gift_button_fieldID) != 0);
  res->accepted_gift_types_ = jni::fetch_tl_object<acceptedGiftTypes>(env, jni::fetch_object(env, p, res->accepted_gift_types_fieldID));
  return res;
}

void giftSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, show_gift_button_fieldID, show_gift_button_);
  if (accepted_gift_types_ != nullptr) { jobject next; accepted_gift_types_->store(env, next); if (next) { env->SetObjectField(s, accepted_gift_types_fieldID, next); env->DeleteLocalRef(next); } }
}

void giftSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftSettings");
    s.store_field("showGiftButton", show_gift_button_);
    s.store_object_field("acceptedGiftTypes", static_cast<const BaseObject *>(accepted_gift_types_.get()));
    s.store_class_end();
  }
}

void giftSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftSettings").c_str());
    show_gift_button_fieldID = jni::get_field_id(env, Class, "showGiftButton", "Z");
    accepted_gift_types_fieldID = jni::get_field_id(env, Class, "acceptedGiftTypes", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AcceptedGiftTypes;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass giftUpgradePreview::Class;
jfieldID giftUpgradePreview::models_fieldID;
jfieldID giftUpgradePreview::symbols_fieldID;
jfieldID giftUpgradePreview::backdrops_fieldID;
jfieldID giftUpgradePreview::prices_fieldID;
jfieldID giftUpgradePreview::next_prices_fieldID;

giftUpgradePreview::giftUpgradePreview()
  : models_()
  , symbols_()
  , backdrops_()
  , prices_()
  , next_prices_()
{}

giftUpgradePreview::giftUpgradePreview(array<object_ptr<upgradedGiftModel>> &&models_, array<object_ptr<upgradedGiftSymbol>> &&symbols_, array<object_ptr<upgradedGiftBackdrop>> &&backdrops_, array<object_ptr<giftUpgradePrice>> &&prices_, array<object_ptr<giftUpgradePrice>> &&next_prices_)
  : models_(std::move(models_))
  , symbols_(std::move(symbols_))
  , backdrops_(std::move(backdrops_))
  , prices_(std::move(prices_))
  , next_prices_(std::move(next_prices_))
{}

const std::int32_t giftUpgradePreview::ID;

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

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

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

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

jclass giftsForResale::Class;
jfieldID giftsForResale::total_count_fieldID;
jfieldID giftsForResale::gifts_fieldID;
jfieldID giftsForResale::models_fieldID;
jfieldID giftsForResale::symbols_fieldID;
jfieldID giftsForResale::backdrops_fieldID;
jfieldID giftsForResale::next_offset_fieldID;

giftsForResale::giftsForResale()
  : total_count_()
  , gifts_()
  , models_()
  , symbols_()
  , backdrops_()
  , next_offset_()
{}

giftsForResale::giftsForResale(int32 total_count_, array<object_ptr<giftForResale>> &&gifts_, array<object_ptr<upgradedGiftModelCount>> &&models_, array<object_ptr<upgradedGiftSymbolCount>> &&symbols_, array<object_ptr<upgradedGiftBackdropCount>> &&backdrops_, string const &next_offset_)
  : total_count_(total_count_)
  , gifts_(std::move(gifts_))
  , models_(std::move(models_))
  , symbols_(std::move(symbols_))
  , backdrops_(std::move(backdrops_))
  , next_offset_(next_offset_)
{}

const std::int32_t giftsForResale::ID;

object_ptr<giftsForResale> giftsForResale::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftsForResale> res = make_object<giftsForResale>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->gifts_ = jni::FetchVector<giftForResale>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->gifts_fieldID));
  res->models_ = jni::FetchVector<upgradedGiftModelCount>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->models_fieldID));
  res->symbols_ = jni::FetchVector<upgradedGiftSymbolCount>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->symbols_fieldID));
  res->backdrops_ = jni::FetchVector<upgradedGiftBackdropCount>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->backdrops_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void giftsForResale::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, total_count_fieldID, total_count_);
  { auto arr_tmp_ = jni::store_vector(env, gifts_); if (arr_tmp_) { env->SetObjectField(s, gifts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, models_); if (arr_tmp_) { env->SetObjectField(s, models_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, symbols_); if (arr_tmp_) { env->SetObjectField(s, symbols_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, backdrops_); if (arr_tmp_) { env->SetObjectField(s, backdrops_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, next_offset_); if (nextString) { env->SetObjectField(s, next_offset_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void giftsForResale::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftsForResale");
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("gifts", gifts_.size()); for (const auto &_value : gifts_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("models", models_.size()); for (const auto &_value : models_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("symbols", symbols_.size()); for (const auto &_value : symbols_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("backdrops", backdrops_.size()); for (const auto &_value : backdrops_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("nextOffset", next_offset_);
    s.store_class_end();
  }
}

void giftsForResale::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftsForResale").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    gifts_fieldID = jni::get_field_id(env, Class, "gifts", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$GiftForResale;").c_str());
    models_fieldID = jni::get_field_id(env, Class, "models", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UpgradedGiftModelCount;").c_str());
    symbols_fieldID = jni::get_field_id(env, Class, "symbols", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UpgradedGiftSymbolCount;").c_str());
    backdrops_fieldID = jni::get_field_id(env, Class, "backdrops", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$UpgradedGiftBackdropCount;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass GiveawayParticipantStatus::Class;

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

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

jclass giveawayParticipantStatusEligible::Class;

giveawayParticipantStatusEligible::giveawayParticipantStatusEligible() {
}

const std::int32_t giveawayParticipantStatusEligible::ID;

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

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

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

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

jclass giveawayParticipantStatusParticipating::Class;

giveawayParticipantStatusParticipating::giveawayParticipantStatusParticipating() {
}

const std::int32_t giveawayParticipantStatusParticipating::ID;

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

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

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

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

jclass giveawayParticipantStatusAlreadyWasMember::Class;
jfieldID giveawayParticipantStatusAlreadyWasMember::joined_chat_date_fieldID;

giveawayParticipantStatusAlreadyWasMember::giveawayParticipantStatusAlreadyWasMember()
  : joined_chat_date_()
{}

giveawayParticipantStatusAlreadyWasMember::giveawayParticipantStatusAlreadyWasMember(int32 joined_chat_date_)
  : joined_chat_date_(joined_chat_date_)
{}

const std::int32_t giveawayParticipantStatusAlreadyWasMember::ID;

object_ptr<GiveawayParticipantStatus> giveawayParticipantStatusAlreadyWasMember::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giveawayParticipantStatusAlreadyWasMember> res = make_object<giveawayParticipantStatusAlreadyWasMember>();
  res->joined_chat_date_ = env->GetIntField(p, res->joined_chat_date_fieldID);
  return std::move(res);
}

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

void giveawayParticipantStatusAlreadyWasMember::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiveawayParticipantStatusAlreadyWasMember");
    s.store_field("joinedChatDate", joined_chat_date_);
    s.store_class_end();
  }
}

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

jclass giveawayParticipantStatusAdministrator::Class;
jfieldID giveawayParticipantStatusAdministrator::chat_id_fieldID;

giveawayParticipantStatusAdministrator::giveawayParticipantStatusAdministrator()
  : chat_id_()
{}

giveawayParticipantStatusAdministrator::giveawayParticipantStatusAdministrator(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t giveawayParticipantStatusAdministrator::ID;

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

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

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

jclass giveawayParticipantStatusDisallowedCountry::Class;
jfieldID giveawayParticipantStatusDisallowedCountry::user_country_code_fieldID;

giveawayParticipantStatusDisallowedCountry::giveawayParticipantStatusDisallowedCountry()
  : user_country_code_()
{}

giveawayParticipantStatusDisallowedCountry::giveawayParticipantStatusDisallowedCountry(string const &user_country_code_)
  : user_country_code_(user_country_code_)
{}

const std::int32_t giveawayParticipantStatusDisallowedCountry::ID;

object_ptr<GiveawayParticipantStatus> giveawayParticipantStatusDisallowedCountry::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giveawayParticipantStatusDisallowedCountry> res = make_object<giveawayParticipantStatusDisallowedCountry>();
  res->user_country_code_ = jni::fetch_string(env, p, res->user_country_code_fieldID);
  return std::move(res);
}

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

void giveawayParticipantStatusDisallowedCountry::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiveawayParticipantStatusDisallowedCountry");
    s.store_field("userCountryCode", user_country_code_);
    s.store_class_end();
  }
}

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

jclass httpUrl::Class;
jfieldID httpUrl::url_fieldID;

httpUrl::httpUrl()
  : url_()
{}

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

const std::int32_t httpUrl::ID;

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

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

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

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

jclass importedContacts::Class;
jfieldID importedContacts::user_ids_fieldID;
jfieldID importedContacts::importer_count_fieldID;

importedContacts::importedContacts()
  : user_ids_()
  , importer_count_()
{}

importedContacts::importedContacts(array<int53> &&user_ids_, array<int32> &&importer_count_)
  : user_ids_(std::move(user_ids_))
  , importer_count_(std::move(importer_count_))
{}

const std::int32_t importedContacts::ID;

object_ptr<importedContacts> importedContacts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<importedContacts> res = make_object<importedContacts>();
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  res->importer_count_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->importer_count_fieldID));
  return res;
}

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

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

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

jclass InlineQueryResultsButtonType::Class;

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

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

jclass inlineQueryResultsButtonTypeStartBot::Class;
jfieldID inlineQueryResultsButtonTypeStartBot::parameter_fieldID;

inlineQueryResultsButtonTypeStartBot::inlineQueryResultsButtonTypeStartBot()
  : parameter_()
{}

inlineQueryResultsButtonTypeStartBot::inlineQueryResultsButtonTypeStartBot(string const &parameter_)
  : parameter_(parameter_)
{}

const std::int32_t inlineQueryResultsButtonTypeStartBot::ID;

object_ptr<InlineQueryResultsButtonType> inlineQueryResultsButtonTypeStartBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inlineQueryResultsButtonTypeStartBot> res = make_object<inlineQueryResultsButtonTypeStartBot>();
  res->parameter_ = jni::fetch_string(env, p, res->parameter_fieldID);
  return std::move(res);
}

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

void inlineQueryResultsButtonTypeStartBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InlineQueryResultsButtonTypeStartBot");
    s.store_field("parameter", parameter_);
    s.store_class_end();
  }
}

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

jclass inlineQueryResultsButtonTypeWebApp::Class;
jfieldID inlineQueryResultsButtonTypeWebApp::url_fieldID;

inlineQueryResultsButtonTypeWebApp::inlineQueryResultsButtonTypeWebApp()
  : url_()
{}

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

const std::int32_t inlineQueryResultsButtonTypeWebApp::ID;

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

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

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

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

jclass InputCredentials::Class;

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

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

jclass inputCredentialsSaved::Class;
jfieldID inputCredentialsSaved::saved_credentials_id_fieldID;

inputCredentialsSaved::inputCredentialsSaved()
  : saved_credentials_id_()
{}

inputCredentialsSaved::inputCredentialsSaved(string const &saved_credentials_id_)
  : saved_credentials_id_(saved_credentials_id_)
{}

const std::int32_t inputCredentialsSaved::ID;

object_ptr<InputCredentials> inputCredentialsSaved::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputCredentialsSaved> res = make_object<inputCredentialsSaved>();
  res->saved_credentials_id_ = jni::fetch_string(env, p, res->saved_credentials_id_fieldID);
  return std::move(res);
}

void inputCredentialsSaved::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputCredentialsSaved");
    s.store_field("savedCredentialsId", saved_credentials_id_);
    s.store_class_end();
  }
}

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

jclass inputCredentialsNew::Class;
jfieldID inputCredentialsNew::data_fieldID;
jfieldID inputCredentialsNew::allow_save_fieldID;

inputCredentialsNew::inputCredentialsNew()
  : data_()
  , allow_save_()
{}

inputCredentialsNew::inputCredentialsNew(string const &data_, bool allow_save_)
  : data_(data_)
  , allow_save_(allow_save_)
{}

const std::int32_t inputCredentialsNew::ID;

object_ptr<InputCredentials> inputCredentialsNew::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputCredentialsNew> res = make_object<inputCredentialsNew>();
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  res->allow_save_ = (env->GetBooleanField(p, res->allow_save_fieldID) != 0);
  return std::move(res);
}

void inputCredentialsNew::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputCredentialsNew");
    s.store_field("data", data_);
    s.store_field("allowSave", allow_save_);
    s.store_class_end();
  }
}

void inputCredentialsNew::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputCredentialsNew").c_str());
    data_fieldID = jni::get_field_id(env, Class, "data", "Ljava/lang/String;");
    allow_save_fieldID = jni::get_field_id(env, Class, "allowSave", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputCredentialsApplePay::Class;
jfieldID inputCredentialsApplePay::data_fieldID;

inputCredentialsApplePay::inputCredentialsApplePay()
  : data_()
{}

inputCredentialsApplePay::inputCredentialsApplePay(string const &data_)
  : data_(data_)
{}

const std::int32_t inputCredentialsApplePay::ID;

object_ptr<InputCredentials> inputCredentialsApplePay::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputCredentialsApplePay> res = make_object<inputCredentialsApplePay>();
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  return std::move(res);
}

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

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

jclass inputCredentialsGooglePay::Class;
jfieldID inputCredentialsGooglePay::data_fieldID;

inputCredentialsGooglePay::inputCredentialsGooglePay()
  : data_()
{}

inputCredentialsGooglePay::inputCredentialsGooglePay(string const &data_)
  : data_(data_)
{}

const std::int32_t inputCredentialsGooglePay::ID;

object_ptr<InputCredentials> inputCredentialsGooglePay::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputCredentialsGooglePay> res = make_object<inputCredentialsGooglePay>();
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  return std::move(res);
}

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

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

jclass invoice::Class;
jfieldID invoice::currency_fieldID;
jfieldID invoice::price_parts_fieldID;
jfieldID invoice::subscription_period_fieldID;
jfieldID invoice::max_tip_amount_fieldID;
jfieldID invoice::suggested_tip_amounts_fieldID;
jfieldID invoice::recurring_payment_terms_of_service_url_fieldID;
jfieldID invoice::terms_of_service_url_fieldID;
jfieldID invoice::is_test_fieldID;
jfieldID invoice::need_name_fieldID;
jfieldID invoice::need_phone_number_fieldID;
jfieldID invoice::need_email_address_fieldID;
jfieldID invoice::need_shipping_address_fieldID;
jfieldID invoice::send_phone_number_to_provider_fieldID;
jfieldID invoice::send_email_address_to_provider_fieldID;
jfieldID invoice::is_flexible_fieldID;

invoice::invoice()
  : currency_()
  , price_parts_()
  , subscription_period_()
  , max_tip_amount_()
  , suggested_tip_amounts_()
  , recurring_payment_terms_of_service_url_()
  , terms_of_service_url_()
  , is_test_()
  , need_name_()
  , need_phone_number_()
  , need_email_address_()
  , need_shipping_address_()
  , send_phone_number_to_provider_()
  , send_email_address_to_provider_()
  , is_flexible_()
{}

invoice::invoice(string const &currency_, array<object_ptr<labeledPricePart>> &&price_parts_, int32 subscription_period_, int53 max_tip_amount_, array<int53> &&suggested_tip_amounts_, string const &recurring_payment_terms_of_service_url_, string const &terms_of_service_url_, bool is_test_, bool need_name_, bool need_phone_number_, bool need_email_address_, bool need_shipping_address_, bool send_phone_number_to_provider_, bool send_email_address_to_provider_, bool is_flexible_)
  : currency_(currency_)
  , price_parts_(std::move(price_parts_))
  , subscription_period_(subscription_period_)
  , max_tip_amount_(max_tip_amount_)
  , suggested_tip_amounts_(std::move(suggested_tip_amounts_))
  , recurring_payment_terms_of_service_url_(recurring_payment_terms_of_service_url_)
  , terms_of_service_url_(terms_of_service_url_)
  , is_test_(is_test_)
  , need_name_(need_name_)
  , need_phone_number_(need_phone_number_)
  , need_email_address_(need_email_address_)
  , need_shipping_address_(need_shipping_address_)
  , send_phone_number_to_provider_(send_phone_number_to_provider_)
  , send_email_address_to_provider_(send_email_address_to_provider_)
  , is_flexible_(is_flexible_)
{}

const std::int32_t invoice::ID;

object_ptr<invoice> invoice::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<invoice> res = make_object<invoice>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->price_parts_ = jni::FetchVector<labeledPricePart>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->price_parts_fieldID));
  res->subscription_period_ = env->GetIntField(p, res->subscription_period_fieldID);
  res->max_tip_amount_ = env->GetLongField(p, res->max_tip_amount_fieldID);
  res->suggested_tip_amounts_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->suggested_tip_amounts_fieldID));
  res->recurring_payment_terms_of_service_url_ = jni::fetch_string(env, p, res->recurring_payment_terms_of_service_url_fieldID);
  res->terms_of_service_url_ = jni::fetch_string(env, p, res->terms_of_service_url_fieldID);
  res->is_test_ = (env->GetBooleanField(p, res->is_test_fieldID) != 0);
  res->need_name_ = (env->GetBooleanField(p, res->need_name_fieldID) != 0);
  res->need_phone_number_ = (env->GetBooleanField(p, res->need_phone_number_fieldID) != 0);
  res->need_email_address_ = (env->GetBooleanField(p, res->need_email_address_fieldID) != 0);
  res->need_shipping_address_ = (env->GetBooleanField(p, res->need_shipping_address_fieldID) != 0);
  res->send_phone_number_to_provider_ = (env->GetBooleanField(p, res->send_phone_number_to_provider_fieldID) != 0);
  res->send_email_address_to_provider_ = (env->GetBooleanField(p, res->send_email_address_to_provider_fieldID) != 0);
  res->is_flexible_ = (env->GetBooleanField(p, res->is_flexible_fieldID) != 0);
  return res;
}

void invoice::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); } }
  { auto arr_tmp_ = jni::store_vector(env, price_parts_); if (arr_tmp_) { env->SetObjectField(s, price_parts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, subscription_period_fieldID, subscription_period_);
  env->SetLongField(s, max_tip_amount_fieldID, max_tip_amount_);
  { auto arr_tmp_ = jni::store_vector(env, suggested_tip_amounts_); if (arr_tmp_) { env->SetObjectField(s, suggested_tip_amounts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, recurring_payment_terms_of_service_url_); if (nextString) { env->SetObjectField(s, recurring_payment_terms_of_service_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, terms_of_service_url_); if (nextString) { env->SetObjectField(s, terms_of_service_url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_test_fieldID, is_test_);
  env->SetBooleanField(s, need_name_fieldID, need_name_);
  env->SetBooleanField(s, need_phone_number_fieldID, need_phone_number_);
  env->SetBooleanField(s, need_email_address_fieldID, need_email_address_);
  env->SetBooleanField(s, need_shipping_address_fieldID, need_shipping_address_);
  env->SetBooleanField(s, send_phone_number_to_provider_fieldID, send_phone_number_to_provider_);
  env->SetBooleanField(s, send_email_address_to_provider_fieldID, send_email_address_to_provider_);
  env->SetBooleanField(s, is_flexible_fieldID, is_flexible_);
}

void invoice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Invoice");
    s.store_field("currency", currency_);
    { s.store_vector_begin("priceParts", price_parts_.size()); for (const auto &_value : price_parts_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("subscriptionPeriod", subscription_period_);
    s.store_field("maxTipAmount", max_tip_amount_);
    { s.store_vector_begin("suggestedTipAmounts", suggested_tip_amounts_.size()); for (const auto &_value : suggested_tip_amounts_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("recurringPaymentTermsOfServiceUrl", recurring_payment_terms_of_service_url_);
    s.store_field("termsOfServiceUrl", terms_of_service_url_);
    s.store_field("isTest", is_test_);
    s.store_field("needName", need_name_);
    s.store_field("needPhoneNumber", need_phone_number_);
    s.store_field("needEmailAddress", need_email_address_);
    s.store_field("needShippingAddress", need_shipping_address_);
    s.store_field("sendPhoneNumberToProvider", send_phone_number_to_provider_);
    s.store_field("sendEmailAddressToProvider", send_email_address_to_provider_);
    s.store_field("isFlexible", is_flexible_);
    s.store_class_end();
  }
}

void invoice::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Invoice").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    price_parts_fieldID = jni::get_field_id(env, Class, "priceParts", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$LabeledPricePart;").c_str());
    subscription_period_fieldID = jni::get_field_id(env, Class, "subscriptionPeriod", "I");
    max_tip_amount_fieldID = jni::get_field_id(env, Class, "maxTipAmount", "J");
    suggested_tip_amounts_fieldID = jni::get_field_id(env, Class, "suggestedTipAmounts", "[J");
    recurring_payment_terms_of_service_url_fieldID = jni::get_field_id(env, Class, "recurringPaymentTermsOfServiceUrl", "Ljava/lang/String;");
    terms_of_service_url_fieldID = jni::get_field_id(env, Class, "termsOfServiceUrl", "Ljava/lang/String;");
    is_test_fieldID = jni::get_field_id(env, Class, "isTest", "Z");
    need_name_fieldID = jni::get_field_id(env, Class, "needName", "Z");
    need_phone_number_fieldID = jni::get_field_id(env, Class, "needPhoneNumber", "Z");
    need_email_address_fieldID = jni::get_field_id(env, Class, "needEmailAddress", "Z");
    need_shipping_address_fieldID = jni::get_field_id(env, Class, "needShippingAddress", "Z");
    send_phone_number_to_provider_fieldID = jni::get_field_id(env, Class, "sendPhoneNumberToProvider", "Z");
    send_email_address_to_provider_fieldID = jni::get_field_id(env, Class, "sendEmailAddressToProvider", "Z");
    is_flexible_fieldID = jni::get_field_id(env, Class, "isFlexible", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass linkPreviewOptions::Class;
jfieldID linkPreviewOptions::is_disabled_fieldID;
jfieldID linkPreviewOptions::url_fieldID;
jfieldID linkPreviewOptions::force_small_media_fieldID;
jfieldID linkPreviewOptions::force_large_media_fieldID;
jfieldID linkPreviewOptions::show_above_text_fieldID;

linkPreviewOptions::linkPreviewOptions()
  : is_disabled_()
  , url_()
  , force_small_media_()
  , force_large_media_()
  , show_above_text_()
{}

linkPreviewOptions::linkPreviewOptions(bool is_disabled_, string const &url_, bool force_small_media_, bool force_large_media_, bool show_above_text_)
  : is_disabled_(is_disabled_)
  , url_(url_)
  , force_small_media_(force_small_media_)
  , force_large_media_(force_large_media_)
  , show_above_text_(show_above_text_)
{}

const std::int32_t linkPreviewOptions::ID;

object_ptr<linkPreviewOptions> linkPreviewOptions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<linkPreviewOptions> res = make_object<linkPreviewOptions>();
  res->is_disabled_ = (env->GetBooleanField(p, res->is_disabled_fieldID) != 0);
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->force_small_media_ = (env->GetBooleanField(p, res->force_small_media_fieldID) != 0);
  res->force_large_media_ = (env->GetBooleanField(p, res->force_large_media_fieldID) != 0);
  res->show_above_text_ = (env->GetBooleanField(p, res->show_above_text_fieldID) != 0);
  return res;
}

void linkPreviewOptions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, is_disabled_fieldID, is_disabled_);
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, force_small_media_fieldID, force_small_media_);
  env->SetBooleanField(s, force_large_media_fieldID, force_large_media_);
  env->SetBooleanField(s, show_above_text_fieldID, show_above_text_);
}

void linkPreviewOptions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LinkPreviewOptions");
    s.store_field("isDisabled", is_disabled_);
    s.store_field("url", url_);
    s.store_field("forceSmallMedia", force_small_media_);
    s.store_field("forceLargeMedia", force_large_media_);
    s.store_field("showAboveText", show_above_text_);
    s.store_class_end();
  }
}

void linkPreviewOptions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$LinkPreviewOptions").c_str());
    is_disabled_fieldID = jni::get_field_id(env, Class, "isDisabled", "Z");
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    force_small_media_fieldID = jni::get_field_id(env, Class, "forceSmallMedia", "Z");
    force_large_media_fieldID = jni::get_field_id(env, Class, "forceLargeMedia", "Z");
    show_above_text_fieldID = jni::get_field_id(env, Class, "showAboveText", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass localizationTargetInfo::Class;
jfieldID localizationTargetInfo::language_packs_fieldID;

localizationTargetInfo::localizationTargetInfo()
  : language_packs_()
{}

localizationTargetInfo::localizationTargetInfo(array<object_ptr<languagePackInfo>> &&language_packs_)
  : language_packs_(std::move(language_packs_))
{}

const std::int32_t localizationTargetInfo::ID;

object_ptr<localizationTargetInfo> localizationTargetInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<localizationTargetInfo> res = make_object<localizationTargetInfo>();
  res->language_packs_ = jni::FetchVector<languagePackInfo>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->language_packs_fieldID));
  return res;
}

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

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

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

jclass logTags::Class;
jfieldID logTags::tags_fieldID;

logTags::logTags()
  : tags_()
{}

logTags::logTags(array<string> &&tags_)
  : tags_(std::move(tags_))
{}

const std::int32_t logTags::ID;

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

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

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

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

jclass messageInteractionInfo::Class;
jfieldID messageInteractionInfo::view_count_fieldID;
jfieldID messageInteractionInfo::forward_count_fieldID;
jfieldID messageInteractionInfo::reply_info_fieldID;
jfieldID messageInteractionInfo::reactions_fieldID;

messageInteractionInfo::messageInteractionInfo()
  : view_count_()
  , forward_count_()
  , reply_info_()
  , reactions_()
{}

messageInteractionInfo::messageInteractionInfo(int32 view_count_, int32 forward_count_, object_ptr<messageReplyInfo> &&reply_info_, object_ptr<messageReactions> &&reactions_)
  : view_count_(view_count_)
  , forward_count_(forward_count_)
  , reply_info_(std::move(reply_info_))
  , reactions_(std::move(reactions_))
{}

const std::int32_t messageInteractionInfo::ID;

object_ptr<messageInteractionInfo> messageInteractionInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageInteractionInfo> res = make_object<messageInteractionInfo>();
  res->view_count_ = env->GetIntField(p, res->view_count_fieldID);
  res->forward_count_ = env->GetIntField(p, res->forward_count_fieldID);
  res->reply_info_ = jni::fetch_tl_object<messageReplyInfo>(env, jni::fetch_object(env, p, res->reply_info_fieldID));
  res->reactions_ = jni::fetch_tl_object<messageReactions>(env, jni::fetch_object(env, p, res->reactions_fieldID));
  return res;
}

void messageInteractionInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, view_count_fieldID, view_count_);
  env->SetIntField(s, forward_count_fieldID, forward_count_);
  if (reply_info_ != nullptr) { jobject next; reply_info_->store(env, next); if (next) { env->SetObjectField(s, reply_info_fieldID, next); env->DeleteLocalRef(next); } }
  if (reactions_ != nullptr) { jobject next; reactions_->store(env, next); if (next) { env->SetObjectField(s, reactions_fieldID, next); env->DeleteLocalRef(next); } }
}

void messageInteractionInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageInteractionInfo");
    s.store_field("viewCount", view_count_);
    s.store_field("forwardCount", forward_count_);
    s.store_object_field("replyInfo", static_cast<const BaseObject *>(reply_info_.get()));
    s.store_object_field("reactions", static_cast<const BaseObject *>(reactions_.get()));
    s.store_class_end();
  }
}

void messageInteractionInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageInteractionInfo").c_str());
    view_count_fieldID = jni::get_field_id(env, Class, "viewCount", "I");
    forward_count_fieldID = jni::get_field_id(env, Class, "forwardCount", "I");
    reply_info_fieldID = jni::get_field_id(env, Class, "replyInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageReplyInfo;").c_str());
    reactions_fieldID = jni::get_field_id(env, Class, "reactions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageReactions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass MessageOrigin::Class;

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

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

jclass messageOriginUser::Class;
jfieldID messageOriginUser::sender_user_id_fieldID;

messageOriginUser::messageOriginUser()
  : sender_user_id_()
{}

messageOriginUser::messageOriginUser(int53 sender_user_id_)
  : sender_user_id_(sender_user_id_)
{}

const std::int32_t messageOriginUser::ID;

object_ptr<MessageOrigin> messageOriginUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageOriginUser> res = make_object<messageOriginUser>();
  res->sender_user_id_ = env->GetLongField(p, res->sender_user_id_fieldID);
  return std::move(res);
}

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

void messageOriginUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageOriginUser");
    s.store_field("senderUserId", sender_user_id_);
    s.store_class_end();
  }
}

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

jclass messageOriginHiddenUser::Class;
jfieldID messageOriginHiddenUser::sender_name_fieldID;

messageOriginHiddenUser::messageOriginHiddenUser()
  : sender_name_()
{}

messageOriginHiddenUser::messageOriginHiddenUser(string const &sender_name_)
  : sender_name_(sender_name_)
{}

const std::int32_t messageOriginHiddenUser::ID;

object_ptr<MessageOrigin> messageOriginHiddenUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageOriginHiddenUser> res = make_object<messageOriginHiddenUser>();
  res->sender_name_ = jni::fetch_string(env, p, res->sender_name_fieldID);
  return std::move(res);
}

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

void messageOriginHiddenUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageOriginHiddenUser");
    s.store_field("senderName", sender_name_);
    s.store_class_end();
  }
}

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

jclass messageOriginChat::Class;
jfieldID messageOriginChat::sender_chat_id_fieldID;
jfieldID messageOriginChat::author_signature_fieldID;

messageOriginChat::messageOriginChat()
  : sender_chat_id_()
  , author_signature_()
{}

messageOriginChat::messageOriginChat(int53 sender_chat_id_, string const &author_signature_)
  : sender_chat_id_(sender_chat_id_)
  , author_signature_(author_signature_)
{}

const std::int32_t messageOriginChat::ID;

object_ptr<MessageOrigin> messageOriginChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageOriginChat> res = make_object<messageOriginChat>();
  res->sender_chat_id_ = env->GetLongField(p, res->sender_chat_id_fieldID);
  res->author_signature_ = jni::fetch_string(env, p, res->author_signature_fieldID);
  return std::move(res);
}

void messageOriginChat::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, sender_chat_id_fieldID, sender_chat_id_);
  { jstring nextString = jni::to_jstring(env, author_signature_); if (nextString) { env->SetObjectField(s, author_signature_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void messageOriginChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageOriginChat");
    s.store_field("senderChatId", sender_chat_id_);
    s.store_field("authorSignature", author_signature_);
    s.store_class_end();
  }
}

void messageOriginChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageOriginChat").c_str());
    sender_chat_id_fieldID = jni::get_field_id(env, Class, "senderChatId", "J");
    author_signature_fieldID = jni::get_field_id(env, Class, "authorSignature", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass messageOriginChannel::Class;
jfieldID messageOriginChannel::chat_id_fieldID;
jfieldID messageOriginChannel::message_id_fieldID;
jfieldID messageOriginChannel::author_signature_fieldID;

messageOriginChannel::messageOriginChannel()
  : chat_id_()
  , message_id_()
  , author_signature_()
{}

messageOriginChannel::messageOriginChannel(int53 chat_id_, int53 message_id_, string const &author_signature_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , author_signature_(author_signature_)
{}

const std::int32_t messageOriginChannel::ID;

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

void messageOriginChannel::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
  { jstring nextString = jni::to_jstring(env, author_signature_); if (nextString) { env->SetObjectField(s, author_signature_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass messagePositions::Class;
jfieldID messagePositions::total_count_fieldID;
jfieldID messagePositions::positions_fieldID;

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

messagePositions::messagePositions(int32 total_count_, array<object_ptr<messagePosition>> &&positions_)
  : total_count_(total_count_)
  , positions_(std::move(positions_))
{}

const std::int32_t messagePositions::ID;

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

void messagePositions::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 messagePositions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessagePositions");
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("positions", positions_.size()); for (const auto &_value : positions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass messageReactions::Class;
jfieldID messageReactions::reactions_fieldID;
jfieldID messageReactions::are_tags_fieldID;
jfieldID messageReactions::paid_reactors_fieldID;
jfieldID messageReactions::can_get_added_reactions_fieldID;

messageReactions::messageReactions()
  : reactions_()
  , are_tags_()
  , paid_reactors_()
  , can_get_added_reactions_()
{}

messageReactions::messageReactions(array<object_ptr<messageReaction>> &&reactions_, bool are_tags_, array<object_ptr<paidReactor>> &&paid_reactors_, bool can_get_added_reactions_)
  : reactions_(std::move(reactions_))
  , are_tags_(are_tags_)
  , paid_reactors_(std::move(paid_reactors_))
  , can_get_added_reactions_(can_get_added_reactions_)
{}

const std::int32_t messageReactions::ID;

object_ptr<messageReactions> messageReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageReactions> res = make_object<messageReactions>();
  res->reactions_ = jni::FetchVector<messageReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->reactions_fieldID));
  res->are_tags_ = (env->GetBooleanField(p, res->are_tags_fieldID) != 0);
  res->paid_reactors_ = jni::FetchVector<paidReactor>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->paid_reactors_fieldID));
  res->can_get_added_reactions_ = (env->GetBooleanField(p, res->can_get_added_reactions_fieldID) != 0);
  return res;
}

void messageReactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, reactions_); if (arr_tmp_) { env->SetObjectField(s, reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, are_tags_fieldID, are_tags_);
  { auto arr_tmp_ = jni::store_vector(env, paid_reactors_); if (arr_tmp_) { env->SetObjectField(s, paid_reactors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, can_get_added_reactions_fieldID, can_get_added_reactions_);
}

void messageReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageReactions");
    { s.store_vector_begin("reactions", reactions_.size()); for (const auto &_value : reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("areTags", are_tags_);
    { s.store_vector_begin("paidReactors", paid_reactors_.size()); for (const auto &_value : paid_reactors_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("canGetAddedReactions", can_get_added_reactions_);
    s.store_class_end();
  }
}

void messageReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MessageReactions").c_str());
    reactions_fieldID = jni::get_field_id(env, Class, "reactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageReaction;").c_str());
    are_tags_fieldID = jni::get_field_id(env, Class, "areTags", "Z");
    paid_reactors_fieldID = jni::get_field_id(env, Class, "paidReactors", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PaidReactor;").c_str());
    can_get_added_reactions_fieldID = jni::get_field_id(env, Class, "canGetAddedReactions", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass messageViewer::Class;
jfieldID messageViewer::user_id_fieldID;
jfieldID messageViewer::view_date_fieldID;

messageViewer::messageViewer()
  : user_id_()
  , view_date_()
{}

messageViewer::messageViewer(int53 user_id_, int32 view_date_)
  : user_id_(user_id_)
  , view_date_(view_date_)
{}

const std::int32_t messageViewer::ID;

object_ptr<messageViewer> messageViewer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageViewer> res = make_object<messageViewer>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->view_date_ = env->GetIntField(p, res->view_date_fieldID);
  return res;
}

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

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

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

jclass PaidMedia::Class;

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

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

jclass paidMediaPreview::Class;
jfieldID paidMediaPreview::width_fieldID;
jfieldID paidMediaPreview::height_fieldID;
jfieldID paidMediaPreview::duration_fieldID;
jfieldID paidMediaPreview::minithumbnail_fieldID;

paidMediaPreview::paidMediaPreview()
  : width_()
  , height_()
  , duration_()
  , minithumbnail_()
{}

paidMediaPreview::paidMediaPreview(int32 width_, int32 height_, int32 duration_, object_ptr<minithumbnail> &&minithumbnail_)
  : width_(width_)
  , height_(height_)
  , duration_(duration_)
  , minithumbnail_(std::move(minithumbnail_))
{}

const std::int32_t paidMediaPreview::ID;

object_ptr<PaidMedia> paidMediaPreview::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paidMediaPreview> res = make_object<paidMediaPreview>();
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  return std::move(res);
}

void paidMediaPreview::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  env->SetIntField(s, duration_fieldID, duration_);
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
}

void paidMediaPreview::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaidMediaPreview");
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("duration", duration_);
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    s.store_class_end();
  }
}

void paidMediaPreview::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaidMediaPreview").c_str());
    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");
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass paidMediaPhoto::Class;
jfieldID paidMediaPhoto::photo_fieldID;
jfieldID paidMediaPhoto::video_fieldID;

paidMediaPhoto::paidMediaPhoto()
  : photo_()
  , video_()
{}

paidMediaPhoto::paidMediaPhoto(object_ptr<photo> &&photo_, object_ptr<video> &&video_)
  : photo_(std::move(photo_))
  , video_(std::move(video_))
{}

const std::int32_t paidMediaPhoto::ID;

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

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

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

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

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

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

paidMediaVideo::paidMediaVideo(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 paidMediaVideo::ID;

object_ptr<PaidMedia> paidMediaVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paidMediaVideo> res = make_object<paidMediaVideo>();
  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 paidMediaVideo::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 paidMediaVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaidMediaVideo");
    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 paidMediaVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaidMediaVideo").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 paidMediaUnsupported::Class;

paidMediaUnsupported::paidMediaUnsupported() {
}

const std::int32_t paidMediaUnsupported::ID;

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

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

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

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

jclass paymentReceipt::Class;
jfieldID paymentReceipt::product_info_fieldID;
jfieldID paymentReceipt::date_fieldID;
jfieldID paymentReceipt::seller_bot_user_id_fieldID;
jfieldID paymentReceipt::type_fieldID;

paymentReceipt::paymentReceipt()
  : product_info_()
  , date_()
  , seller_bot_user_id_()
  , type_()
{}

paymentReceipt::paymentReceipt(object_ptr<productInfo> &&product_info_, int32 date_, int53 seller_bot_user_id_, object_ptr<PaymentReceiptType> &&type_)
  : product_info_(std::move(product_info_))
  , date_(date_)
  , seller_bot_user_id_(seller_bot_user_id_)
  , type_(std::move(type_))
{}

const std::int32_t paymentReceipt::ID;

object_ptr<paymentReceipt> paymentReceipt::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<paymentReceipt> res = make_object<paymentReceipt>();
  res->product_info_ = jni::fetch_tl_object<productInfo>(env, jni::fetch_object(env, p, res->product_info_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->seller_bot_user_id_ = env->GetLongField(p, res->seller_bot_user_id_fieldID);
  res->type_ = jni::fetch_tl_object<PaymentReceiptType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void paymentReceipt::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (product_info_ != nullptr) { jobject next; product_info_->store(env, next); if (next) { env->SetObjectField(s, product_info_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  env->SetLongField(s, seller_bot_user_id_fieldID, seller_bot_user_id_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void paymentReceipt::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PaymentReceipt");
    s.store_object_field("productInfo", static_cast<const BaseObject *>(product_info_.get()));
    s.store_field("date", date_);
    s.store_field("sellerBotUserId", seller_bot_user_id_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void paymentReceipt::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PaymentReceipt").c_str());
    product_info_fieldID = jni::get_field_id(env, Class, "productInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProductInfo;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    seller_bot_user_id_fieldID = jni::get_field_id(env, Class, "sellerBotUserId", "J");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PaymentReceiptType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass personalDetails::Class;
jfieldID personalDetails::first_name_fieldID;
jfieldID personalDetails::middle_name_fieldID;
jfieldID personalDetails::last_name_fieldID;
jfieldID personalDetails::native_first_name_fieldID;
jfieldID personalDetails::native_middle_name_fieldID;
jfieldID personalDetails::native_last_name_fieldID;
jfieldID personalDetails::birthdate_fieldID;
jfieldID personalDetails::gender_fieldID;
jfieldID personalDetails::country_code_fieldID;
jfieldID personalDetails::residence_country_code_fieldID;

personalDetails::personalDetails()
  : first_name_()
  , middle_name_()
  , last_name_()
  , native_first_name_()
  , native_middle_name_()
  , native_last_name_()
  , birthdate_()
  , gender_()
  , country_code_()
  , residence_country_code_()
{}

personalDetails::personalDetails(string const &first_name_, string const &middle_name_, string const &last_name_, string const &native_first_name_, string const &native_middle_name_, string const &native_last_name_, object_ptr<date> &&birthdate_, string const &gender_, string const &country_code_, string const &residence_country_code_)
  : first_name_(first_name_)
  , middle_name_(middle_name_)
  , last_name_(last_name_)
  , native_first_name_(native_first_name_)
  , native_middle_name_(native_middle_name_)
  , native_last_name_(native_last_name_)
  , birthdate_(std::move(birthdate_))
  , gender_(gender_)
  , country_code_(country_code_)
  , residence_country_code_(residence_country_code_)
{}

const std::int32_t personalDetails::ID;

object_ptr<personalDetails> personalDetails::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<personalDetails> res = make_object<personalDetails>();
  res->first_name_ = jni::fetch_string(env, p, res->first_name_fieldID);
  res->middle_name_ = jni::fetch_string(env, p, res->middle_name_fieldID);
  res->last_name_ = jni::fetch_string(env, p, res->last_name_fieldID);
  res->native_first_name_ = jni::fetch_string(env, p, res->native_first_name_fieldID);
  res->native_middle_name_ = jni::fetch_string(env, p, res->native_middle_name_fieldID);
  res->native_last_name_ = jni::fetch_string(env, p, res->native_last_name_fieldID);
  res->birthdate_ = jni::fetch_tl_object<date>(env, jni::fetch_object(env, p, res->birthdate_fieldID));
  res->gender_ = jni::fetch_string(env, p, res->gender_fieldID);
  res->country_code_ = jni::fetch_string(env, p, res->country_code_fieldID);
  res->residence_country_code_ = jni::fetch_string(env, p, res->residence_country_code_fieldID);
  return res;
}

void personalDetails::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, first_name_); if (nextString) { env->SetObjectField(s, first_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, middle_name_); if (nextString) { env->SetObjectField(s, middle_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, last_name_); if (nextString) { env->SetObjectField(s, last_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, native_first_name_); if (nextString) { env->SetObjectField(s, native_first_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, native_middle_name_); if (nextString) { env->SetObjectField(s, native_middle_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, native_last_name_); if (nextString) { env->SetObjectField(s, native_last_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (birthdate_ != nullptr) { jobject next; birthdate_->store(env, next); if (next) { env->SetObjectField(s, birthdate_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, gender_); if (nextString) { env->SetObjectField(s, gender_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, country_code_); if (nextString) { env->SetObjectField(s, country_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, residence_country_code_); if (nextString) { env->SetObjectField(s, residence_country_code_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void personalDetails::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PersonalDetails");
    s.store_field("firstName", first_name_);
    s.store_field("middleName", middle_name_);
    s.store_field("lastName", last_name_);
    s.store_field("nativeFirstName", native_first_name_);
    s.store_field("nativeMiddleName", native_middle_name_);
    s.store_field("nativeLastName", native_last_name_);
    s.store_object_field("birthdate", static_cast<const BaseObject *>(birthdate_.get()));
    s.store_field("gender", gender_);
    s.store_field("countryCode", country_code_);
    s.store_field("residenceCountryCode", residence_country_code_);
    s.store_class_end();
  }
}

void personalDetails::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PersonalDetails").c_str());
    first_name_fieldID = jni::get_field_id(env, Class, "firstName", "Ljava/lang/String;");
    middle_name_fieldID = jni::get_field_id(env, Class, "middleName", "Ljava/lang/String;");
    last_name_fieldID = jni::get_field_id(env, Class, "lastName", "Ljava/lang/String;");
    native_first_name_fieldID = jni::get_field_id(env, Class, "nativeFirstName", "Ljava/lang/String;");
    native_middle_name_fieldID = jni::get_field_id(env, Class, "nativeMiddleName", "Ljava/lang/String;");
    native_last_name_fieldID = jni::get_field_id(env, Class, "nativeLastName", "Ljava/lang/String;");
    birthdate_fieldID = jni::get_field_id(env, Class, "birthdate", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Date;").c_str());
    gender_fieldID = jni::get_field_id(env, Class, "gender", "Ljava/lang/String;");
    country_code_fieldID = jni::get_field_id(env, Class, "countryCode", "Ljava/lang/String;");
    residence_country_code_fieldID = jni::get_field_id(env, Class, "residenceCountryCode", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass premiumFeaturePromotionAnimation::Class;
jfieldID premiumFeaturePromotionAnimation::feature_fieldID;
jfieldID premiumFeaturePromotionAnimation::animation_fieldID;

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

premiumFeaturePromotionAnimation::premiumFeaturePromotionAnimation(object_ptr<PremiumFeature> &&feature_, object_ptr<animation> &&animation_)
  : feature_(std::move(feature_))
  , animation_(std::move(animation_))
{}

const std::int32_t premiumFeaturePromotionAnimation::ID;

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

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

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

void premiumFeaturePromotionAnimation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumFeaturePromotionAnimation").c_str());
    feature_fieldID = jni::get_field_id(env, Class, "feature", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PremiumFeature;").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 publicForwards::Class;
jfieldID publicForwards::total_count_fieldID;
jfieldID publicForwards::forwards_fieldID;
jfieldID publicForwards::next_offset_fieldID;

publicForwards::publicForwards()
  : total_count_()
  , forwards_()
  , next_offset_()
{}

publicForwards::publicForwards(int32 total_count_, array<object_ptr<PublicForward>> &&forwards_, string const &next_offset_)
  : total_count_(total_count_)
  , forwards_(std::move(forwards_))
  , next_offset_(next_offset_)
{}

const std::int32_t publicForwards::ID;

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

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

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

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

jclass quickReplyShortcut::Class;
jfieldID quickReplyShortcut::id_fieldID;
jfieldID quickReplyShortcut::name_fieldID;
jfieldID quickReplyShortcut::first_message_fieldID;
jfieldID quickReplyShortcut::message_count_fieldID;

quickReplyShortcut::quickReplyShortcut()
  : id_()
  , name_()
  , first_message_()
  , message_count_()
{}

quickReplyShortcut::quickReplyShortcut(int32 id_, string const &name_, object_ptr<quickReplyMessage> &&first_message_, int32 message_count_)
  : id_(id_)
  , name_(name_)
  , first_message_(std::move(first_message_))
  , message_count_(message_count_)
{}

const std::int32_t quickReplyShortcut::ID;

object_ptr<quickReplyShortcut> quickReplyShortcut::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<quickReplyShortcut> res = make_object<quickReplyShortcut>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->first_message_ = jni::fetch_tl_object<quickReplyMessage>(env, jni::fetch_object(env, p, res->first_message_fieldID));
  res->message_count_ = env->GetIntField(p, res->message_count_fieldID);
  return res;
}

void quickReplyShortcut::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (first_message_ != nullptr) { jobject next; first_message_->store(env, next); if (next) { env->SetObjectField(s, first_message_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, message_count_fieldID, message_count_);
}

void quickReplyShortcut::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "QuickReplyShortcut");
    s.store_field("id", id_);
    s.store_field("name", name_);
    s.store_object_field("firstMessage", static_cast<const BaseObject *>(first_message_.get()));
    s.store_field("messageCount", message_count_);
    s.store_class_end();
  }
}

void quickReplyShortcut::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$QuickReplyShortcut").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    first_message_fieldID = jni::get_field_id(env, Class, "firstMessage", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$QuickReplyMessage;").c_str());
    message_count_fieldID = jni::get_field_id(env, Class, "messageCount", "I");
    return true;
  }();
  (void)is_inited;
}

jclass ReactionType::Class;

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

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

jclass reactionTypeEmoji::Class;
jfieldID reactionTypeEmoji::emoji_fieldID;

reactionTypeEmoji::reactionTypeEmoji()
  : emoji_()
{}

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

const std::int32_t reactionTypeEmoji::ID;

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

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

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

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

jclass reactionTypeCustomEmoji::Class;
jfieldID reactionTypeCustomEmoji::custom_emoji_id_fieldID;

reactionTypeCustomEmoji::reactionTypeCustomEmoji()
  : custom_emoji_id_()
{}

reactionTypeCustomEmoji::reactionTypeCustomEmoji(int64 custom_emoji_id_)
  : custom_emoji_id_(custom_emoji_id_)
{}

const std::int32_t reactionTypeCustomEmoji::ID;

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

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

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

jclass reactionTypePaid::Class;

reactionTypePaid::reactionTypePaid() {
}

const std::int32_t reactionTypePaid::ID;

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

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

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

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

jclass recoveryEmailAddress::Class;
jfieldID recoveryEmailAddress::recovery_email_address_fieldID;

recoveryEmailAddress::recoveryEmailAddress()
  : recovery_email_address_()
{}

recoveryEmailAddress::recoveryEmailAddress(string const &recovery_email_address_)
  : recovery_email_address_(recovery_email_address_)
{}

const std::int32_t recoveryEmailAddress::ID;

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

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

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

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

jclass savedMessagesTag::Class;
jfieldID savedMessagesTag::tag_fieldID;
jfieldID savedMessagesTag::label_fieldID;
jfieldID savedMessagesTag::count_fieldID;

savedMessagesTag::savedMessagesTag()
  : tag_()
  , label_()
  , count_()
{}

savedMessagesTag::savedMessagesTag(object_ptr<ReactionType> &&tag_, string const &label_, int32 count_)
  : tag_(std::move(tag_))
  , label_(label_)
  , count_(count_)
{}

const std::int32_t savedMessagesTag::ID;

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

void savedMessagesTag::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (tag_ != nullptr) { jobject next; tag_->store(env, next); if (next) { env->SetObjectField(s, tag_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, label_); if (nextString) { env->SetObjectField(s, label_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, count_fieldID, count_);
}

void savedMessagesTag::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SavedMessagesTag");
    s.store_object_field("tag", static_cast<const BaseObject *>(tag_.get()));
    s.store_field("label", label_);
    s.store_field("count", count_);
    s.store_class_end();
  }
}

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

jclass SavedMessagesTopicType::Class;

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

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

jclass savedMessagesTopicTypeMyNotes::Class;

savedMessagesTopicTypeMyNotes::savedMessagesTopicTypeMyNotes() {
}

const std::int32_t savedMessagesTopicTypeMyNotes::ID;

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

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

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

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

jclass savedMessagesTopicTypeAuthorHidden::Class;

savedMessagesTopicTypeAuthorHidden::savedMessagesTopicTypeAuthorHidden() {
}

const std::int32_t savedMessagesTopicTypeAuthorHidden::ID;

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

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

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

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

jclass savedMessagesTopicTypeSavedFromChat::Class;
jfieldID savedMessagesTopicTypeSavedFromChat::chat_id_fieldID;

savedMessagesTopicTypeSavedFromChat::savedMessagesTopicTypeSavedFromChat()
  : chat_id_()
{}

savedMessagesTopicTypeSavedFromChat::savedMessagesTopicTypeSavedFromChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t savedMessagesTopicTypeSavedFromChat::ID;

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

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

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

jclass scopeAutosaveSettings::Class;
jfieldID scopeAutosaveSettings::autosave_photos_fieldID;
jfieldID scopeAutosaveSettings::autosave_videos_fieldID;
jfieldID scopeAutosaveSettings::max_video_file_size_fieldID;

scopeAutosaveSettings::scopeAutosaveSettings()
  : autosave_photos_()
  , autosave_videos_()
  , max_video_file_size_()
{}

scopeAutosaveSettings::scopeAutosaveSettings(bool autosave_photos_, bool autosave_videos_, int53 max_video_file_size_)
  : autosave_photos_(autosave_photos_)
  , autosave_videos_(autosave_videos_)
  , max_video_file_size_(max_video_file_size_)
{}

const std::int32_t scopeAutosaveSettings::ID;

object_ptr<scopeAutosaveSettings> scopeAutosaveSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<scopeAutosaveSettings> res = make_object<scopeAutosaveSettings>();
  res->autosave_photos_ = (env->GetBooleanField(p, res->autosave_photos_fieldID) != 0);
  res->autosave_videos_ = (env->GetBooleanField(p, res->autosave_videos_fieldID) != 0);
  res->max_video_file_size_ = env->GetLongField(p, res->max_video_file_size_fieldID);
  return res;
}

void scopeAutosaveSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, autosave_photos_fieldID, autosave_photos_);
  env->SetBooleanField(s, autosave_videos_fieldID, autosave_videos_);
  env->SetLongField(s, max_video_file_size_fieldID, max_video_file_size_);
}

void scopeAutosaveSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ScopeAutosaveSettings");
    s.store_field("autosavePhotos", autosave_photos_);
    s.store_field("autosaveVideos", autosave_videos_);
    s.store_field("maxVideoFileSize", max_video_file_size_);
    s.store_class_end();
  }
}

void scopeAutosaveSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ScopeAutosaveSettings").c_str());
    autosave_photos_fieldID = jni::get_field_id(env, Class, "autosavePhotos", "Z");
    autosave_videos_fieldID = jni::get_field_id(env, Class, "autosaveVideos", "Z");
    max_video_file_size_fieldID = jni::get_field_id(env, Class, "maxVideoFileSize", "J");
    return true;
  }();
  (void)is_inited;
}

jclass sponsoredMessage::Class;
jfieldID sponsoredMessage::message_id_fieldID;
jfieldID sponsoredMessage::is_recommended_fieldID;
jfieldID sponsoredMessage::can_be_reported_fieldID;
jfieldID sponsoredMessage::content_fieldID;
jfieldID sponsoredMessage::sponsor_fieldID;
jfieldID sponsoredMessage::title_fieldID;
jfieldID sponsoredMessage::button_text_fieldID;
jfieldID sponsoredMessage::accent_color_id_fieldID;
jfieldID sponsoredMessage::background_custom_emoji_id_fieldID;
jfieldID sponsoredMessage::additional_info_fieldID;

sponsoredMessage::sponsoredMessage()
  : message_id_()
  , is_recommended_()
  , can_be_reported_()
  , content_()
  , sponsor_()
  , title_()
  , button_text_()
  , accent_color_id_()
  , background_custom_emoji_id_()
  , additional_info_()
{}

sponsoredMessage::sponsoredMessage(int53 message_id_, bool is_recommended_, bool can_be_reported_, object_ptr<MessageContent> &&content_, object_ptr<advertisementSponsor> &&sponsor_, string const &title_, string const &button_text_, int32 accent_color_id_, int64 background_custom_emoji_id_, string const &additional_info_)
  : message_id_(message_id_)
  , is_recommended_(is_recommended_)
  , can_be_reported_(can_be_reported_)
  , content_(std::move(content_))
  , sponsor_(std::move(sponsor_))
  , title_(title_)
  , button_text_(button_text_)
  , accent_color_id_(accent_color_id_)
  , background_custom_emoji_id_(background_custom_emoji_id_)
  , additional_info_(additional_info_)
{}

const std::int32_t sponsoredMessage::ID;

object_ptr<sponsoredMessage> sponsoredMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sponsoredMessage> res = make_object<sponsoredMessage>();
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->is_recommended_ = (env->GetBooleanField(p, res->is_recommended_fieldID) != 0);
  res->can_be_reported_ = (env->GetBooleanField(p, res->can_be_reported_fieldID) != 0);
  res->content_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  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->button_text_ = jni::fetch_string(env, p, res->button_text_fieldID);
  res->accent_color_id_ = env->GetIntField(p, res->accent_color_id_fieldID);
  res->background_custom_emoji_id_ = env->GetLongField(p, res->background_custom_emoji_id_fieldID);
  res->additional_info_ = jni::fetch_string(env, p, res->additional_info_fieldID);
  return res;
}

void sponsoredMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, message_id_fieldID, message_id_);
  env->SetBooleanField(s, is_recommended_fieldID, is_recommended_);
  env->SetBooleanField(s, can_be_reported_fieldID, can_be_reported_);
  if (content_ != nullptr) { jobject next; content_->store(env, next); if (next) { env->SetObjectField(s, content_fieldID, next); env->DeleteLocalRef(next); } }
  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, button_text_); if (nextString) { env->SetObjectField(s, button_text_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, accent_color_id_fieldID, accent_color_id_);
  env->SetLongField(s, background_custom_emoji_id_fieldID, background_custom_emoji_id_);
  { jstring nextString = jni::to_jstring(env, additional_info_); if (nextString) { env->SetObjectField(s, additional_info_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void sponsoredMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SponsoredMessage");
    s.store_field("messageId", message_id_);
    s.store_field("isRecommended", is_recommended_);
    s.store_field("canBeReported", can_be_reported_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_object_field("sponsor", static_cast<const BaseObject *>(sponsor_.get()));
    s.store_field("title", title_);
    s.store_field("buttonText", button_text_);
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("backgroundCustomEmojiId", background_custom_emoji_id_);
    s.store_field("additionalInfo", additional_info_);
    s.store_class_end();
  }
}

void sponsoredMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SponsoredMessage").c_str());
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "J");
    is_recommended_fieldID = jni::get_field_id(env, Class, "isRecommended", "Z");
    can_be_reported_fieldID = jni::get_field_id(env, Class, "canBeReported", "Z");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    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;");
    button_text_fieldID = jni::get_field_id(env, Class, "buttonText", "Ljava/lang/String;");
    accent_color_id_fieldID = jni::get_field_id(env, Class, "accentColorId", "I");
    background_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "backgroundCustomEmojiId", "J");
    additional_info_fieldID = jni::get_field_id(env, Class, "additionalInfo", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass StartLiveStoryResult::Class;

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

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

jclass startLiveStoryResultOk::Class;
jfieldID startLiveStoryResultOk::story_fieldID;

startLiveStoryResultOk::startLiveStoryResultOk()
  : story_()
{}

startLiveStoryResultOk::startLiveStoryResultOk(object_ptr<story> &&story_)
  : story_(std::move(story_))
{}

const std::int32_t startLiveStoryResultOk::ID;

object_ptr<StartLiveStoryResult> startLiveStoryResultOk::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<startLiveStoryResultOk> res = make_object<startLiveStoryResultOk>();
  res->story_ = jni::fetch_tl_object<story>(env, jni::fetch_object(env, p, res->story_fieldID));
  return std::move(res);
}

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

void startLiveStoryResultOk::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StartLiveStoryResultOk");
    s.store_object_field("story", static_cast<const BaseObject *>(story_.get()));
    s.store_class_end();
  }
}

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

jclass startLiveStoryResultFail::Class;
jfieldID startLiveStoryResultFail::error_type_fieldID;

startLiveStoryResultFail::startLiveStoryResultFail()
  : error_type_()
{}

startLiveStoryResultFail::startLiveStoryResultFail(object_ptr<CanPostStoryResult> &&error_type_)
  : error_type_(std::move(error_type_))
{}

const std::int32_t startLiveStoryResultFail::ID;

object_ptr<StartLiveStoryResult> startLiveStoryResultFail::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<startLiveStoryResultFail> res = make_object<startLiveStoryResultFail>();
  res->error_type_ = jni::fetch_tl_object<CanPostStoryResult>(env, jni::fetch_object(env, p, res->error_type_fieldID));
  return std::move(res);
}

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

void startLiveStoryResultFail::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StartLiveStoryResultFail");
    s.store_object_field("errorType", static_cast<const BaseObject *>(error_type_.get()));
    s.store_class_end();
  }
}

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

jclass StorePaymentPurpose::Class;

object_ptr<StorePaymentPurpose> StorePaymentPurpose::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case storePaymentPurposePremiumSubscription::ID:
      return storePaymentPurposePremiumSubscription::fetch(env, p);
    case storePaymentPurposePremiumGift::ID:
      return storePaymentPurposePremiumGift::fetch(env, p);
    case storePaymentPurposePremiumGiftCodes::ID:
      return storePaymentPurposePremiumGiftCodes::fetch(env, p);
    case storePaymentPurposePremiumGiveaway::ID:
      return storePaymentPurposePremiumGiveaway::fetch(env, p);
    case storePaymentPurposeStarGiveaway::ID:
      return storePaymentPurposeStarGiveaway::fetch(env, p);
    case storePaymentPurposeStars::ID:
      return storePaymentPurposeStars::fetch(env, p);
    case storePaymentPurposeGiftedStars::ID:
      return storePaymentPurposeGiftedStars::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass storePaymentPurposePremiumSubscription::Class;
jfieldID storePaymentPurposePremiumSubscription::is_restore_fieldID;
jfieldID storePaymentPurposePremiumSubscription::is_upgrade_fieldID;

storePaymentPurposePremiumSubscription::storePaymentPurposePremiumSubscription()
  : is_restore_()
  , is_upgrade_()
{}

storePaymentPurposePremiumSubscription::storePaymentPurposePremiumSubscription(bool is_restore_, bool is_upgrade_)
  : is_restore_(is_restore_)
  , is_upgrade_(is_upgrade_)
{}

const std::int32_t storePaymentPurposePremiumSubscription::ID;

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

void storePaymentPurposePremiumSubscription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorePaymentPurposePremiumSubscription");
    s.store_field("isRestore", is_restore_);
    s.store_field("isUpgrade", is_upgrade_);
    s.store_class_end();
  }
}

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

jclass storePaymentPurposePremiumGift::Class;
jfieldID storePaymentPurposePremiumGift::currency_fieldID;
jfieldID storePaymentPurposePremiumGift::amount_fieldID;
jfieldID storePaymentPurposePremiumGift::user_id_fieldID;
jfieldID storePaymentPurposePremiumGift::text_fieldID;

storePaymentPurposePremiumGift::storePaymentPurposePremiumGift()
  : currency_()
  , amount_()
  , user_id_()
  , text_()
{}

storePaymentPurposePremiumGift::storePaymentPurposePremiumGift(string const &currency_, int53 amount_, int53 user_id_, object_ptr<formattedText> &&text_)
  : currency_(currency_)
  , amount_(amount_)
  , user_id_(user_id_)
  , text_(std::move(text_))
{}

const std::int32_t storePaymentPurposePremiumGift::ID;

object_ptr<StorePaymentPurpose> storePaymentPurposePremiumGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storePaymentPurposePremiumGift> res = make_object<storePaymentPurposePremiumGift>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

void storePaymentPurposePremiumGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorePaymentPurposePremiumGift");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("userId", user_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void storePaymentPurposePremiumGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorePaymentPurposePremiumGift").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    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 storePaymentPurposePremiumGiftCodes::Class;
jfieldID storePaymentPurposePremiumGiftCodes::boosted_chat_id_fieldID;
jfieldID storePaymentPurposePremiumGiftCodes::currency_fieldID;
jfieldID storePaymentPurposePremiumGiftCodes::amount_fieldID;
jfieldID storePaymentPurposePremiumGiftCodes::user_ids_fieldID;
jfieldID storePaymentPurposePremiumGiftCodes::text_fieldID;

storePaymentPurposePremiumGiftCodes::storePaymentPurposePremiumGiftCodes()
  : boosted_chat_id_()
  , currency_()
  , amount_()
  , user_ids_()
  , text_()
{}

storePaymentPurposePremiumGiftCodes::storePaymentPurposePremiumGiftCodes(int53 boosted_chat_id_, string const &currency_, int53 amount_, array<int53> &&user_ids_, object_ptr<formattedText> &&text_)
  : boosted_chat_id_(boosted_chat_id_)
  , currency_(currency_)
  , amount_(amount_)
  , user_ids_(std::move(user_ids_))
  , text_(std::move(text_))
{}

const std::int32_t storePaymentPurposePremiumGiftCodes::ID;

object_ptr<StorePaymentPurpose> storePaymentPurposePremiumGiftCodes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storePaymentPurposePremiumGiftCodes> res = make_object<storePaymentPurposePremiumGiftCodes>();
  res->boosted_chat_id_ = env->GetLongField(p, res->boosted_chat_id_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->user_ids_fieldID));
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

void storePaymentPurposePremiumGiftCodes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorePaymentPurposePremiumGiftCodes");
    s.store_field("boostedChatId", boosted_chat_id_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    { s.store_vector_begin("userIds", user_ids_.size()); for (const auto &_value : user_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_class_end();
  }
}

void storePaymentPurposePremiumGiftCodes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorePaymentPurposePremiumGiftCodes").c_str());
    boosted_chat_id_fieldID = jni::get_field_id(env, Class, "boostedChatId", "J");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    user_ids_fieldID = jni::get_field_id(env, Class, "userIds", "[J");
    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 storePaymentPurposePremiumGiveaway::Class;
jfieldID storePaymentPurposePremiumGiveaway::parameters_fieldID;
jfieldID storePaymentPurposePremiumGiveaway::currency_fieldID;
jfieldID storePaymentPurposePremiumGiveaway::amount_fieldID;

storePaymentPurposePremiumGiveaway::storePaymentPurposePremiumGiveaway()
  : parameters_()
  , currency_()
  , amount_()
{}

storePaymentPurposePremiumGiveaway::storePaymentPurposePremiumGiveaway(object_ptr<giveawayParameters> &&parameters_, string const &currency_, int53 amount_)
  : parameters_(std::move(parameters_))
  , currency_(currency_)
  , amount_(amount_)
{}

const std::int32_t storePaymentPurposePremiumGiveaway::ID;

object_ptr<StorePaymentPurpose> storePaymentPurposePremiumGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storePaymentPurposePremiumGiveaway> res = make_object<storePaymentPurposePremiumGiveaway>();
  res->parameters_ = jni::fetch_tl_object<giveawayParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  return std::move(res);
}

void storePaymentPurposePremiumGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorePaymentPurposePremiumGiveaway");
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_class_end();
  }
}

void storePaymentPurposePremiumGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorePaymentPurposePremiumGiveaway").c_str());
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayParameters;").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass storePaymentPurposeStarGiveaway::Class;
jfieldID storePaymentPurposeStarGiveaway::parameters_fieldID;
jfieldID storePaymentPurposeStarGiveaway::currency_fieldID;
jfieldID storePaymentPurposeStarGiveaway::amount_fieldID;
jfieldID storePaymentPurposeStarGiveaway::winner_count_fieldID;
jfieldID storePaymentPurposeStarGiveaway::star_count_fieldID;

storePaymentPurposeStarGiveaway::storePaymentPurposeStarGiveaway()
  : parameters_()
  , currency_()
  , amount_()
  , winner_count_()
  , star_count_()
{}

storePaymentPurposeStarGiveaway::storePaymentPurposeStarGiveaway(object_ptr<giveawayParameters> &&parameters_, string const &currency_, int53 amount_, int32 winner_count_, int53 star_count_)
  : parameters_(std::move(parameters_))
  , currency_(currency_)
  , amount_(amount_)
  , winner_count_(winner_count_)
  , star_count_(star_count_)
{}

const std::int32_t storePaymentPurposeStarGiveaway::ID;

object_ptr<StorePaymentPurpose> storePaymentPurposeStarGiveaway::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storePaymentPurposeStarGiveaway> res = make_object<storePaymentPurposeStarGiveaway>();
  res->parameters_ = jni::fetch_tl_object<giveawayParameters>(env, jni::fetch_object(env, p, res->parameters_fieldID));
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->winner_count_ = env->GetIntField(p, res->winner_count_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return std::move(res);
}

void storePaymentPurposeStarGiveaway::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorePaymentPurposeStarGiveaway");
    s.store_object_field("parameters", static_cast<const BaseObject *>(parameters_.get()));
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("winnerCount", winner_count_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

void storePaymentPurposeStarGiveaway::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorePaymentPurposeStarGiveaway").c_str());
    parameters_fieldID = jni::get_field_id(env, Class, "parameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiveawayParameters;").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    winner_count_fieldID = jni::get_field_id(env, Class, "winnerCount", "I");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass storePaymentPurposeStars::Class;
jfieldID storePaymentPurposeStars::currency_fieldID;
jfieldID storePaymentPurposeStars::amount_fieldID;
jfieldID storePaymentPurposeStars::star_count_fieldID;
jfieldID storePaymentPurposeStars::chat_id_fieldID;

storePaymentPurposeStars::storePaymentPurposeStars()
  : currency_()
  , amount_()
  , star_count_()
  , chat_id_()
{}

storePaymentPurposeStars::storePaymentPurposeStars(string const &currency_, int53 amount_, int53 star_count_, int53 chat_id_)
  : currency_(currency_)
  , amount_(amount_)
  , star_count_(star_count_)
  , chat_id_(chat_id_)
{}

const std::int32_t storePaymentPurposeStars::ID;

object_ptr<StorePaymentPurpose> storePaymentPurposeStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storePaymentPurposeStars> res = make_object<storePaymentPurposeStars>();
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  return std::move(res);
}

void storePaymentPurposeStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorePaymentPurposeStars");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("starCount", star_count_);
    s.store_field("chatId", chat_id_);
    s.store_class_end();
  }
}

void storePaymentPurposeStars::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorePaymentPurposeStars").c_str());
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass storePaymentPurposeGiftedStars::Class;
jfieldID storePaymentPurposeGiftedStars::user_id_fieldID;
jfieldID storePaymentPurposeGiftedStars::currency_fieldID;
jfieldID storePaymentPurposeGiftedStars::amount_fieldID;
jfieldID storePaymentPurposeGiftedStars::star_count_fieldID;

storePaymentPurposeGiftedStars::storePaymentPurposeGiftedStars()
  : user_id_()
  , currency_()
  , amount_()
  , star_count_()
{}

storePaymentPurposeGiftedStars::storePaymentPurposeGiftedStars(int53 user_id_, string const &currency_, int53 amount_, int53 star_count_)
  : user_id_(user_id_)
  , currency_(currency_)
  , amount_(amount_)
  , star_count_(star_count_)
{}

const std::int32_t storePaymentPurposeGiftedStars::ID;

object_ptr<StorePaymentPurpose> storePaymentPurposeGiftedStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storePaymentPurposeGiftedStars> res = make_object<storePaymentPurposeGiftedStars>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->currency_ = jni::fetch_string(env, p, res->currency_fieldID);
  res->amount_ = env->GetLongField(p, res->amount_fieldID);
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return std::move(res);
}

void storePaymentPurposeGiftedStars::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorePaymentPurposeGiftedStars");
    s.store_field("userId", user_id_);
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

void storePaymentPurposeGiftedStars::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorePaymentPurposeGiftedStars").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    currency_fieldID = jni::get_field_id(env, Class, "currency", "Ljava/lang/String;");
    amount_fieldID = jni::get_field_id(env, Class, "amount", "J");
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass StoryAreaType::Class;

object_ptr<StoryAreaType> StoryAreaType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case storyAreaTypeLocation::ID:
      return storyAreaTypeLocation::fetch(env, p);
    case storyAreaTypeVenue::ID:
      return storyAreaTypeVenue::fetch(env, p);
    case storyAreaTypeSuggestedReaction::ID:
      return storyAreaTypeSuggestedReaction::fetch(env, p);
    case storyAreaTypeMessage::ID:
      return storyAreaTypeMessage::fetch(env, p);
    case storyAreaTypeLink::ID:
      return storyAreaTypeLink::fetch(env, p);
    case storyAreaTypeWeather::ID:
      return storyAreaTypeWeather::fetch(env, p);
    case storyAreaTypeUpgradedGift::ID:
      return storyAreaTypeUpgradedGift::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass storyAreaTypeLocation::Class;
jfieldID storyAreaTypeLocation::location_fieldID;
jfieldID storyAreaTypeLocation::address_fieldID;

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

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

const std::int32_t storyAreaTypeLocation::ID;

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

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

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

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

jclass storyAreaTypeVenue::Class;
jfieldID storyAreaTypeVenue::venue_fieldID;

storyAreaTypeVenue::storyAreaTypeVenue()
  : venue_()
{}

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

const std::int32_t storyAreaTypeVenue::ID;

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

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

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

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

jclass storyAreaTypeSuggestedReaction::Class;
jfieldID storyAreaTypeSuggestedReaction::reaction_type_fieldID;
jfieldID storyAreaTypeSuggestedReaction::total_count_fieldID;
jfieldID storyAreaTypeSuggestedReaction::is_dark_fieldID;
jfieldID storyAreaTypeSuggestedReaction::is_flipped_fieldID;

storyAreaTypeSuggestedReaction::storyAreaTypeSuggestedReaction()
  : reaction_type_()
  , total_count_()
  , is_dark_()
  , is_flipped_()
{}

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

const std::int32_t storyAreaTypeSuggestedReaction::ID;

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

void storyAreaTypeSuggestedReaction::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (reaction_type_ != nullptr) { jobject next; reaction_type_->store(env, next); if (next) { env->SetObjectField(s, reaction_type_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, total_count_fieldID, total_count_);
  env->SetBooleanField(s, is_dark_fieldID, is_dark_);
  env->SetBooleanField(s, is_flipped_fieldID, is_flipped_);
}

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

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

jclass storyAreaTypeMessage::Class;
jfieldID storyAreaTypeMessage::chat_id_fieldID;
jfieldID storyAreaTypeMessage::message_id_fieldID;

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

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

const std::int32_t storyAreaTypeMessage::ID;

object_ptr<StoryAreaType> storyAreaTypeMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyAreaTypeMessage> res = make_object<storyAreaTypeMessage>();
  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 storyAreaTypeMessage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, chat_id_fieldID, chat_id_);
  env->SetLongField(s, message_id_fieldID, message_id_);
}

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

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

storyAreaTypeLink::storyAreaTypeLink()
  : url_()
{}

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

const std::int32_t storyAreaTypeLink::ID;

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

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

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

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

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

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

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

const std::int32_t storyAreaTypeWeather::ID;

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

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

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

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

jclass storyAreaTypeUpgradedGift::Class;
jfieldID storyAreaTypeUpgradedGift::gift_name_fieldID;

storyAreaTypeUpgradedGift::storyAreaTypeUpgradedGift()
  : gift_name_()
{}

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

const std::int32_t storyAreaTypeUpgradedGift::ID;

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

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

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

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

jclass storyInfo::Class;
jfieldID storyInfo::story_id_fieldID;
jfieldID storyInfo::date_fieldID;
jfieldID storyInfo::is_for_close_friends_fieldID;
jfieldID storyInfo::is_live_fieldID;

storyInfo::storyInfo()
  : story_id_()
  , date_()
  , is_for_close_friends_()
  , is_live_()
{}

storyInfo::storyInfo(int32 story_id_, int32 date_, bool is_for_close_friends_, bool is_live_)
  : story_id_(story_id_)
  , date_(date_)
  , is_for_close_friends_(is_for_close_friends_)
  , is_live_(is_live_)
{}

const std::int32_t storyInfo::ID;

object_ptr<storyInfo> storyInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyInfo> res = make_object<storyInfo>();
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->is_for_close_friends_ = (env->GetBooleanField(p, res->is_for_close_friends_fieldID) != 0);
  res->is_live_ = (env->GetBooleanField(p, res->is_live_fieldID) != 0);
  return res;
}

void storyInfo::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_);
  env->SetIntField(s, date_fieldID, date_);
  env->SetBooleanField(s, is_for_close_friends_fieldID, is_for_close_friends_);
  env->SetBooleanField(s, is_live_fieldID, is_live_);
}

void storyInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryInfo");
    s.store_field("storyId", story_id_);
    s.store_field("date", date_);
    s.store_field("isForCloseFriends", is_for_close_friends_);
    s.store_field("isLive", is_live_);
    s.store_class_end();
  }
}

void storyInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryInfo").c_str());
    story_id_fieldID = jni::get_field_id(env, Class, "storyId", "I");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    is_for_close_friends_fieldID = jni::get_field_id(env, Class, "isForCloseFriends", "Z");
    is_live_fieldID = jni::get_field_id(env, Class, "isLive", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass SuggestedPostPrice::Class;

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

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

jclass suggestedPostPriceStar::Class;
jfieldID suggestedPostPriceStar::star_count_fieldID;

suggestedPostPriceStar::suggestedPostPriceStar()
  : star_count_()
{}

suggestedPostPriceStar::suggestedPostPriceStar(int53 star_count_)
  : star_count_(star_count_)
{}

const std::int32_t suggestedPostPriceStar::ID;

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

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

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

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

jclass suggestedPostPriceTon::Class;
jfieldID suggestedPostPriceTon::toncoin_cent_count_fieldID;

suggestedPostPriceTon::suggestedPostPriceTon()
  : toncoin_cent_count_()
{}

suggestedPostPriceTon::suggestedPostPriceTon(int53 toncoin_cent_count_)
  : toncoin_cent_count_(toncoin_cent_count_)
{}

const std::int32_t suggestedPostPriceTon::ID;

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

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

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

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

jclass SupergroupMembersFilter::Class;

object_ptr<SupergroupMembersFilter> SupergroupMembersFilter::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case supergroupMembersFilterRecent::ID:
      return supergroupMembersFilterRecent::fetch(env, p);
    case supergroupMembersFilterContacts::ID:
      return supergroupMembersFilterContacts::fetch(env, p);
    case supergroupMembersFilterAdministrators::ID:
      return supergroupMembersFilterAdministrators::fetch(env, p);
    case supergroupMembersFilterSearch::ID:
      return supergroupMembersFilterSearch::fetch(env, p);
    case supergroupMembersFilterRestricted::ID:
      return supergroupMembersFilterRestricted::fetch(env, p);
    case supergroupMembersFilterBanned::ID:
      return supergroupMembersFilterBanned::fetch(env, p);
    case supergroupMembersFilterMention::ID:
      return supergroupMembersFilterMention::fetch(env, p);
    case supergroupMembersFilterBots::ID:
      return supergroupMembersFilterBots::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass supergroupMembersFilterRecent::Class;

supergroupMembersFilterRecent::supergroupMembersFilterRecent() {
}

const std::int32_t supergroupMembersFilterRecent::ID;

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

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

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

jclass supergroupMembersFilterContacts::Class;
jfieldID supergroupMembersFilterContacts::query_fieldID;

supergroupMembersFilterContacts::supergroupMembersFilterContacts()
  : query_()
{}

supergroupMembersFilterContacts::supergroupMembersFilterContacts(string const &query_)
  : query_(query_)
{}

const std::int32_t supergroupMembersFilterContacts::ID;

object_ptr<SupergroupMembersFilter> supergroupMembersFilterContacts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<supergroupMembersFilterContacts> res = make_object<supergroupMembersFilterContacts>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  return std::move(res);
}

void supergroupMembersFilterContacts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SupergroupMembersFilterContacts");
    s.store_field("query", query_);
    s.store_class_end();
  }
}

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

jclass supergroupMembersFilterAdministrators::Class;

supergroupMembersFilterAdministrators::supergroupMembersFilterAdministrators() {
}

const std::int32_t supergroupMembersFilterAdministrators::ID;

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

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

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

jclass supergroupMembersFilterSearch::Class;
jfieldID supergroupMembersFilterSearch::query_fieldID;

supergroupMembersFilterSearch::supergroupMembersFilterSearch()
  : query_()
{}

supergroupMembersFilterSearch::supergroupMembersFilterSearch(string const &query_)
  : query_(query_)
{}

const std::int32_t supergroupMembersFilterSearch::ID;

object_ptr<SupergroupMembersFilter> supergroupMembersFilterSearch::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<supergroupMembersFilterSearch> res = make_object<supergroupMembersFilterSearch>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  return std::move(res);
}

void supergroupMembersFilterSearch::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SupergroupMembersFilterSearch");
    s.store_field("query", query_);
    s.store_class_end();
  }
}

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

jclass supergroupMembersFilterRestricted::Class;
jfieldID supergroupMembersFilterRestricted::query_fieldID;

supergroupMembersFilterRestricted::supergroupMembersFilterRestricted()
  : query_()
{}

supergroupMembersFilterRestricted::supergroupMembersFilterRestricted(string const &query_)
  : query_(query_)
{}

const std::int32_t supergroupMembersFilterRestricted::ID;

object_ptr<SupergroupMembersFilter> supergroupMembersFilterRestricted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<supergroupMembersFilterRestricted> res = make_object<supergroupMembersFilterRestricted>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  return std::move(res);
}

void supergroupMembersFilterRestricted::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SupergroupMembersFilterRestricted");
    s.store_field("query", query_);
    s.store_class_end();
  }
}

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

jclass supergroupMembersFilterBanned::Class;
jfieldID supergroupMembersFilterBanned::query_fieldID;

supergroupMembersFilterBanned::supergroupMembersFilterBanned()
  : query_()
{}

supergroupMembersFilterBanned::supergroupMembersFilterBanned(string const &query_)
  : query_(query_)
{}

const std::int32_t supergroupMembersFilterBanned::ID;

object_ptr<SupergroupMembersFilter> supergroupMembersFilterBanned::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<supergroupMembersFilterBanned> res = make_object<supergroupMembersFilterBanned>();
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  return std::move(res);
}

void supergroupMembersFilterBanned::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SupergroupMembersFilterBanned");
    s.store_field("query", query_);
    s.store_class_end();
  }
}

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

jclass supergroupMembersFilterMention::Class;
jfieldID supergroupMembersFilterMention::query_fieldID;
jfieldID supergroupMembersFilterMention::topic_id_fieldID;

supergroupMembersFilterMention::supergroupMembersFilterMention()
  : query_()
  , topic_id_()
{}

supergroupMembersFilterMention::supergroupMembersFilterMention(string const &query_, object_ptr<MessageTopic> &&topic_id_)
  : query_(query_)
  , topic_id_(std::move(topic_id_))
{}

const std::int32_t supergroupMembersFilterMention::ID;

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

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

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

jclass supergroupMembersFilterBots::Class;

supergroupMembersFilterBots::supergroupMembersFilterBots() {
}

const std::int32_t supergroupMembersFilterBots::ID;

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

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

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

jclass termsOfService::Class;
jfieldID termsOfService::text_fieldID;
jfieldID termsOfService::min_user_age_fieldID;
jfieldID termsOfService::show_popup_fieldID;

termsOfService::termsOfService()
  : text_()
  , min_user_age_()
  , show_popup_()
{}

termsOfService::termsOfService(object_ptr<formattedText> &&text_, int32 min_user_age_, bool show_popup_)
  : text_(std::move(text_))
  , min_user_age_(min_user_age_)
  , show_popup_(show_popup_)
{}

const std::int32_t termsOfService::ID;

object_ptr<termsOfService> termsOfService::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<termsOfService> res = make_object<termsOfService>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->min_user_age_ = env->GetIntField(p, res->min_user_age_fieldID);
  res->show_popup_ = (env->GetBooleanField(p, res->show_popup_fieldID) != 0);
  return res;
}

void termsOfService::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, min_user_age_fieldID, min_user_age_);
  env->SetBooleanField(s, show_popup_fieldID, show_popup_);
}

void termsOfService::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TermsOfService");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("minUserAge", min_user_age_);
    s.store_field("showPopup", show_popup_);
    s.store_class_end();
  }
}

void termsOfService::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TermsOfService").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    min_user_age_fieldID = jni::get_field_id(env, Class, "minUserAge", "I");
    show_popup_fieldID = jni::get_field_id(env, Class, "showPopup", "Z");
    return true;
  }();
  (void)is_inited;
}

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

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

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

const std::int32_t textEntity::ID;

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

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

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

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

jclass themeSettings::Class;
jfieldID themeSettings::base_theme_fieldID;
jfieldID themeSettings::accent_color_fieldID;
jfieldID themeSettings::background_fieldID;
jfieldID themeSettings::outgoing_message_fill_fieldID;
jfieldID themeSettings::animate_outgoing_message_fill_fieldID;
jfieldID themeSettings::outgoing_message_accent_color_fieldID;

themeSettings::themeSettings()
  : base_theme_()
  , accent_color_()
  , background_()
  , outgoing_message_fill_()
  , animate_outgoing_message_fill_()
  , outgoing_message_accent_color_()
{}

themeSettings::themeSettings(object_ptr<BuiltInTheme> &&base_theme_, int32 accent_color_, object_ptr<background> &&background_, object_ptr<BackgroundFill> &&outgoing_message_fill_, bool animate_outgoing_message_fill_, int32 outgoing_message_accent_color_)
  : base_theme_(std::move(base_theme_))
  , accent_color_(accent_color_)
  , background_(std::move(background_))
  , outgoing_message_fill_(std::move(outgoing_message_fill_))
  , animate_outgoing_message_fill_(animate_outgoing_message_fill_)
  , outgoing_message_accent_color_(outgoing_message_accent_color_)
{}

const std::int32_t themeSettings::ID;

object_ptr<themeSettings> themeSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<themeSettings> res = make_object<themeSettings>();
  res->base_theme_ = jni::fetch_tl_object<BuiltInTheme>(env, jni::fetch_object(env, p, res->base_theme_fieldID));
  res->accent_color_ = env->GetIntField(p, res->accent_color_fieldID);
  res->background_ = jni::fetch_tl_object<background>(env, jni::fetch_object(env, p, res->background_fieldID));
  res->outgoing_message_fill_ = jni::fetch_tl_object<BackgroundFill>(env, jni::fetch_object(env, p, res->outgoing_message_fill_fieldID));
  res->animate_outgoing_message_fill_ = (env->GetBooleanField(p, res->animate_outgoing_message_fill_fieldID) != 0);
  res->outgoing_message_accent_color_ = env->GetIntField(p, res->outgoing_message_accent_color_fieldID);
  return res;
}

void themeSettings::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (base_theme_ != nullptr) { jobject next; base_theme_->store(env, next); if (next) { env->SetObjectField(s, base_theme_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, accent_color_fieldID, accent_color_);
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
  if (outgoing_message_fill_ != nullptr) { jobject next; outgoing_message_fill_->store(env, next); if (next) { env->SetObjectField(s, outgoing_message_fill_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, animate_outgoing_message_fill_fieldID, animate_outgoing_message_fill_);
  env->SetIntField(s, outgoing_message_accent_color_fieldID, outgoing_message_accent_color_);
}

void themeSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ThemeSettings");
    s.store_object_field("baseTheme", static_cast<const BaseObject *>(base_theme_.get()));
    s.store_field("accentColor", accent_color_);
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_object_field("outgoingMessageFill", static_cast<const BaseObject *>(outgoing_message_fill_.get()));
    s.store_field("animateOutgoingMessageFill", animate_outgoing_message_fill_);
    s.store_field("outgoingMessageAccentColor", outgoing_message_accent_color_);
    s.store_class_end();
  }
}

void themeSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ThemeSettings").c_str());
    base_theme_fieldID = jni::get_field_id(env, Class, "baseTheme", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BuiltInTheme;").c_str());
    accent_color_fieldID = jni::get_field_id(env, Class, "accentColor", "I");
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Background;").c_str());
    outgoing_message_fill_fieldID = jni::get_field_id(env, Class, "outgoingMessageFill", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BackgroundFill;").c_str());
    animate_outgoing_message_fill_fieldID = jni::get_field_id(env, Class, "animateOutgoingMessageFill", "Z");
    outgoing_message_accent_color_fieldID = jni::get_field_id(env, Class, "outgoingMessageAccentColor", "I");
    return true;
  }();
  (void)is_inited;
}

jclass timeZones::Class;
jfieldID timeZones::time_zones_fieldID;

timeZones::timeZones()
  : time_zones_()
{}

timeZones::timeZones(array<object_ptr<timeZone>> &&time_zones_)
  : time_zones_(std::move(time_zones_))
{}

const std::int32_t timeZones::ID;

object_ptr<timeZones> timeZones::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<timeZones> res = make_object<timeZones>();
  res->time_zones_ = jni::FetchVector<timeZone>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->time_zones_fieldID));
  return res;
}

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

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

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

jclass UpgradedGiftAttributeRarity::Class;

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

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

jclass upgradedGiftAttributeRarityPerMille::Class;
jfieldID upgradedGiftAttributeRarityPerMille::per_mille_fieldID;

upgradedGiftAttributeRarityPerMille::upgradedGiftAttributeRarityPerMille()
  : per_mille_()
{}

upgradedGiftAttributeRarityPerMille::upgradedGiftAttributeRarityPerMille(int32 per_mille_)
  : per_mille_(per_mille_)
{}

const std::int32_t upgradedGiftAttributeRarityPerMille::ID;

object_ptr<UpgradedGiftAttributeRarity> upgradedGiftAttributeRarityPerMille::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftAttributeRarityPerMille> res = make_object<upgradedGiftAttributeRarityPerMille>();
  res->per_mille_ = env->GetIntField(p, res->per_mille_fieldID);
  return std::move(res);
}

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

void upgradedGiftAttributeRarityPerMille::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftAttributeRarityPerMille");
    s.store_field("perMille", per_mille_);
    s.store_class_end();
  }
}

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

jclass upgradedGiftAttributeRarityUncommon::Class;

upgradedGiftAttributeRarityUncommon::upgradedGiftAttributeRarityUncommon() {
}

const std::int32_t upgradedGiftAttributeRarityUncommon::ID;

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

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

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

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

jclass upgradedGiftAttributeRarityRare::Class;

upgradedGiftAttributeRarityRare::upgradedGiftAttributeRarityRare() {
}

const std::int32_t upgradedGiftAttributeRarityRare::ID;

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

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

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

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

jclass upgradedGiftAttributeRarityEpic::Class;

upgradedGiftAttributeRarityEpic::upgradedGiftAttributeRarityEpic() {
}

const std::int32_t upgradedGiftAttributeRarityEpic::ID;

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

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

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

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

jclass upgradedGiftAttributeRarityLegendary::Class;

upgradedGiftAttributeRarityLegendary::upgradedGiftAttributeRarityLegendary() {
}

const std::int32_t upgradedGiftAttributeRarityLegendary::ID;

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

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

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

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

jclass userAuctionBid::Class;
jfieldID userAuctionBid::star_count_fieldID;
jfieldID userAuctionBid::bid_date_fieldID;
jfieldID userAuctionBid::next_bid_star_count_fieldID;
jfieldID userAuctionBid::owner_id_fieldID;
jfieldID userAuctionBid::was_returned_fieldID;

userAuctionBid::userAuctionBid()
  : star_count_()
  , bid_date_()
  , next_bid_star_count_()
  , owner_id_()
  , was_returned_()
{}

userAuctionBid::userAuctionBid(int53 star_count_, int32 bid_date_, int53 next_bid_star_count_, object_ptr<MessageSender> &&owner_id_, bool was_returned_)
  : star_count_(star_count_)
  , bid_date_(bid_date_)
  , next_bid_star_count_(next_bid_star_count_)
  , owner_id_(std::move(owner_id_))
  , was_returned_(was_returned_)
{}

const std::int32_t userAuctionBid::ID;

object_ptr<userAuctionBid> userAuctionBid::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userAuctionBid> res = make_object<userAuctionBid>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->bid_date_ = env->GetIntField(p, res->bid_date_fieldID);
  res->next_bid_star_count_ = env->GetLongField(p, res->next_bid_star_count_fieldID);
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->was_returned_ = (env->GetBooleanField(p, res->was_returned_fieldID) != 0);
  return res;
}

void userAuctionBid::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, star_count_fieldID, star_count_);
  env->SetIntField(s, bid_date_fieldID, bid_date_);
  env->SetLongField(s, next_bid_star_count_fieldID, next_bid_star_count_);
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, was_returned_fieldID, was_returned_);
}

void userAuctionBid::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserAuctionBid");
    s.store_field("starCount", star_count_);
    s.store_field("bidDate", bid_date_);
    s.store_field("nextBidStarCount", next_bid_star_count_);
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("wasReturned", was_returned_);
    s.store_class_end();
  }
}

void userAuctionBid::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UserAuctionBid").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    bid_date_fieldID = jni::get_field_id(env, Class, "bidDate", "I");
    next_bid_star_count_fieldID = jni::get_field_id(env, Class, "nextBidStarCount", "J");
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    was_returned_fieldID = jni::get_field_id(env, Class, "wasReturned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass userPrivacySettingRules::Class;
jfieldID userPrivacySettingRules::rules_fieldID;

userPrivacySettingRules::userPrivacySettingRules()
  : rules_()
{}

userPrivacySettingRules::userPrivacySettingRules(array<object_ptr<UserPrivacySettingRule>> &&rules_)
  : rules_(std::move(rules_))
{}

const std::int32_t userPrivacySettingRules::ID;

object_ptr<userPrivacySettingRules> userPrivacySettingRules::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userPrivacySettingRules> res = make_object<userPrivacySettingRules>();
  res->rules_ = jni::FetchVector<UserPrivacySettingRule>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->rules_fieldID));
  return res;
}

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

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

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

jclass UserStatus::Class;

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

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

jclass userStatusEmpty::Class;

userStatusEmpty::userStatusEmpty() {
}

const std::int32_t userStatusEmpty::ID;

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

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

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

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

jclass userStatusOnline::Class;
jfieldID userStatusOnline::expires_fieldID;

userStatusOnline::userStatusOnline()
  : expires_()
{}

userStatusOnline::userStatusOnline(int32 expires_)
  : expires_(expires_)
{}

const std::int32_t userStatusOnline::ID;

object_ptr<UserStatus> userStatusOnline::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userStatusOnline> res = make_object<userStatusOnline>();
  res->expires_ = env->GetIntField(p, res->expires_fieldID);
  return std::move(res);
}

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

void userStatusOnline::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserStatusOnline");
    s.store_field("expires", expires_);
    s.store_class_end();
  }
}

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

jclass userStatusOffline::Class;
jfieldID userStatusOffline::was_online_fieldID;

userStatusOffline::userStatusOffline()
  : was_online_()
{}

userStatusOffline::userStatusOffline(int32 was_online_)
  : was_online_(was_online_)
{}

const std::int32_t userStatusOffline::ID;

object_ptr<UserStatus> userStatusOffline::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userStatusOffline> res = make_object<userStatusOffline>();
  res->was_online_ = env->GetIntField(p, res->was_online_fieldID);
  return std::move(res);
}

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

void userStatusOffline::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserStatusOffline");
    s.store_field("wasOnline", was_online_);
    s.store_class_end();
  }
}

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

jclass userStatusRecently::Class;
jfieldID userStatusRecently::by_my_privacy_settings_fieldID;

userStatusRecently::userStatusRecently()
  : by_my_privacy_settings_()
{}

userStatusRecently::userStatusRecently(bool by_my_privacy_settings_)
  : by_my_privacy_settings_(by_my_privacy_settings_)
{}

const std::int32_t userStatusRecently::ID;

object_ptr<UserStatus> userStatusRecently::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userStatusRecently> res = make_object<userStatusRecently>();
  res->by_my_privacy_settings_ = (env->GetBooleanField(p, res->by_my_privacy_settings_fieldID) != 0);
  return std::move(res);
}

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

void userStatusRecently::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserStatusRecently");
    s.store_field("byMyPrivacySettings", by_my_privacy_settings_);
    s.store_class_end();
  }
}

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

jclass userStatusLastWeek::Class;
jfieldID userStatusLastWeek::by_my_privacy_settings_fieldID;

userStatusLastWeek::userStatusLastWeek()
  : by_my_privacy_settings_()
{}

userStatusLastWeek::userStatusLastWeek(bool by_my_privacy_settings_)
  : by_my_privacy_settings_(by_my_privacy_settings_)
{}

const std::int32_t userStatusLastWeek::ID;

object_ptr<UserStatus> userStatusLastWeek::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userStatusLastWeek> res = make_object<userStatusLastWeek>();
  res->by_my_privacy_settings_ = (env->GetBooleanField(p, res->by_my_privacy_settings_fieldID) != 0);
  return std::move(res);
}

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

void userStatusLastWeek::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserStatusLastWeek");
    s.store_field("byMyPrivacySettings", by_my_privacy_settings_);
    s.store_class_end();
  }
}

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

jclass userStatusLastMonth::Class;
jfieldID userStatusLastMonth::by_my_privacy_settings_fieldID;

userStatusLastMonth::userStatusLastMonth()
  : by_my_privacy_settings_()
{}

userStatusLastMonth::userStatusLastMonth(bool by_my_privacy_settings_)
  : by_my_privacy_settings_(by_my_privacy_settings_)
{}

const std::int32_t userStatusLastMonth::ID;

object_ptr<UserStatus> userStatusLastMonth::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<userStatusLastMonth> res = make_object<userStatusLastMonth>();
  res->by_my_privacy_settings_ = (env->GetBooleanField(p, res->by_my_privacy_settings_fieldID) != 0);
  return std::move(res);
}

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

void userStatusLastMonth::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UserStatusLastMonth");
    s.store_field("byMyPrivacySettings", by_my_privacy_settings_);
    s.store_class_end();
  }
}

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

jclass video::Class;
jfieldID video::duration_fieldID;
jfieldID video::width_fieldID;
jfieldID video::height_fieldID;
jfieldID video::file_name_fieldID;
jfieldID video::mime_type_fieldID;
jfieldID video::has_stickers_fieldID;
jfieldID video::supports_streaming_fieldID;
jfieldID video::minithumbnail_fieldID;
jfieldID video::thumbnail_fieldID;
jfieldID video::video_fieldID;

video::video()
  : duration_()
  , width_()
  , height_()
  , file_name_()
  , mime_type_()
  , has_stickers_()
  , supports_streaming_()
  , minithumbnail_()
  , thumbnail_()
  , video_()
{}

video::video(int32 duration_, int32 width_, int32 height_, string const &file_name_, string const &mime_type_, bool has_stickers_, bool supports_streaming_, object_ptr<minithumbnail> &&minithumbnail_, object_ptr<thumbnail> &&thumbnail_, object_ptr<file> &&video_)
  : duration_(duration_)
  , width_(width_)
  , height_(height_)
  , file_name_(file_name_)
  , mime_type_(mime_type_)
  , has_stickers_(has_stickers_)
  , supports_streaming_(supports_streaming_)
  , minithumbnail_(std::move(minithumbnail_))
  , thumbnail_(std::move(thumbnail_))
  , video_(std::move(video_))
{}

const std::int32_t video::ID;

object_ptr<video> video::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<video> res = make_object<video>();
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->file_name_ = jni::fetch_string(env, p, res->file_name_fieldID);
  res->mime_type_ = jni::fetch_string(env, p, res->mime_type_fieldID);
  res->has_stickers_ = (env->GetBooleanField(p, res->has_stickers_fieldID) != 0);
  res->supports_streaming_ = (env->GetBooleanField(p, res->supports_streaming_fieldID) != 0);
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->video_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->video_fieldID));
  return res;
}

void video::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, duration_fieldID, duration_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  { jstring nextString = jni::to_jstring(env, file_name_); if (nextString) { env->SetObjectField(s, file_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, mime_type_); if (nextString) { env->SetObjectField(s, mime_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, has_stickers_fieldID, has_stickers_);
  env->SetBooleanField(s, supports_streaming_fieldID, supports_streaming_);
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
}

void video::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Video");
    s.store_field("duration", duration_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("fileName", file_name_);
    s.store_field("mimeType", mime_type_);
    s.store_field("hasStickers", has_stickers_);
    s.store_field("supportsStreaming", supports_streaming_);
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_class_end();
  }
}

void video::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Video").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");
    file_name_fieldID = jni::get_field_id(env, Class, "fileName", "Ljava/lang/String;");
    mime_type_fieldID = jni::get_field_id(env, Class, "mimeType", "Ljava/lang/String;");
    has_stickers_fieldID = jni::get_field_id(env, Class, "hasStickers", "Z");
    supports_streaming_fieldID = jni::get_field_id(env, Class, "supportsStreaming", "Z");
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass videoNote::Class;
jfieldID videoNote::duration_fieldID;
jfieldID videoNote::waveform_fieldID;
jfieldID videoNote::length_fieldID;
jfieldID videoNote::minithumbnail_fieldID;
jfieldID videoNote::thumbnail_fieldID;
jfieldID videoNote::speech_recognition_result_fieldID;
jfieldID videoNote::video_fieldID;

videoNote::videoNote()
  : duration_()
  , waveform_()
  , length_()
  , minithumbnail_()
  , thumbnail_()
  , speech_recognition_result_()
  , video_()
{}

videoNote::videoNote(int32 duration_, bytes const &waveform_, int32 length_, object_ptr<minithumbnail> &&minithumbnail_, object_ptr<thumbnail> &&thumbnail_, object_ptr<SpeechRecognitionResult> &&speech_recognition_result_, object_ptr<file> &&video_)
  : duration_(duration_)
  , waveform_(std::move(waveform_))
  , length_(length_)
  , minithumbnail_(std::move(minithumbnail_))
  , thumbnail_(std::move(thumbnail_))
  , speech_recognition_result_(std::move(speech_recognition_result_))
  , video_(std::move(video_))
{}

const std::int32_t videoNote::ID;

object_ptr<videoNote> videoNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<videoNote> res = make_object<videoNote>();
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->waveform_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->waveform_fieldID));
  res->length_ = env->GetIntField(p, res->length_fieldID);
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->speech_recognition_result_ = jni::fetch_tl_object<SpeechRecognitionResult>(env, jni::fetch_object(env, p, res->speech_recognition_result_fieldID));
  res->video_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->video_fieldID));
  return res;
}

void videoNote::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, duration_fieldID, duration_);
  { jbyteArray nextBytes = jni::to_bytes(env, waveform_); if (nextBytes) { env->SetObjectField(s, waveform_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
  env->SetIntField(s, length_fieldID, length_);
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (thumbnail_ != nullptr) { jobject next; thumbnail_->store(env, next); if (next) { env->SetObjectField(s, thumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  if (speech_recognition_result_ != nullptr) { jobject next; speech_recognition_result_->store(env, next); if (next) { env->SetObjectField(s, speech_recognition_result_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_ != nullptr) { jobject next; video_->store(env, next); if (next) { env->SetObjectField(s, video_fieldID, next); env->DeleteLocalRef(next); } }
}

void videoNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VideoNote");
    s.store_field("duration", duration_);
    s.store_bytes_field("waveform", waveform_);
    s.store_field("length", length_);
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("speechRecognitionResult", static_cast<const BaseObject *>(speech_recognition_result_.get()));
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_class_end();
  }
}

void videoNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$VideoNote").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    waveform_fieldID = jni::get_field_id(env, Class, "waveform", "[B");
    length_fieldID = jni::get_field_id(env, Class, "length", "I");
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    speech_recognition_result_fieldID = jni::get_field_id(env, Class, "speechRecognitionResult", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SpeechRecognitionResult;").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addLogMessage::Class;
jfieldID addLogMessage::verbosity_level_fieldID;
jfieldID addLogMessage::text_fieldID;

addLogMessage::addLogMessage()
  : verbosity_level_()
  , text_()
{}

addLogMessage::addLogMessage(int32 verbosity_level_, string const &text_)
  : verbosity_level_(verbosity_level_)
  , text_(text_)
{}

const std::int32_t addLogMessage::ID;

object_ptr<addLogMessage> addLogMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addLogMessage> res = make_object<addLogMessage>();
  res->verbosity_level_ = env->GetIntField(p, res->verbosity_level_fieldID);
  res->text_ = jni::fetch_string(env, p, res->text_fieldID);
  return res;
}

void addLogMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddLogMessage");
    s.store_field("verbosityLevel", verbosity_level_);
    s.store_field("text", text_);
    s.store_class_end();
  }
}

addLogMessage::ReturnType addLogMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass addLoginPasskey::Class;
jfieldID addLoginPasskey::client_data_fieldID;
jfieldID addLoginPasskey::attestation_object_fieldID;

addLoginPasskey::addLoginPasskey()
  : client_data_()
  , attestation_object_()
{}

addLoginPasskey::addLoginPasskey(string const &client_data_, bytes const &attestation_object_)
  : client_data_(client_data_)
  , attestation_object_(std::move(attestation_object_))
{}

const std::int32_t addLoginPasskey::ID;

object_ptr<addLoginPasskey> addLoginPasskey::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addLoginPasskey> res = make_object<addLoginPasskey>();
  res->client_data_ = jni::fetch_string(env, p, res->client_data_fieldID);
  res->attestation_object_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->attestation_object_fieldID));
  return res;
}

void addLoginPasskey::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddLoginPasskey");
    s.store_field("clientData", client_data_);
    s.store_bytes_field("attestationObject", attestation_object_);
    s.store_class_end();
  }
}

addLoginPasskey::ReturnType addLoginPasskey::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passkey::fetch(env, p);
}

void addLoginPasskey::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddLoginPasskey").c_str());
    client_data_fieldID = jni::get_field_id(env, Class, "clientData", "Ljava/lang/String;");
    attestation_object_fieldID = jni::get_field_id(env, Class, "attestationObject", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass addQuickReplyShortcutMessage::Class;
jfieldID addQuickReplyShortcutMessage::shortcut_name_fieldID;
jfieldID addQuickReplyShortcutMessage::reply_to_message_id_fieldID;
jfieldID addQuickReplyShortcutMessage::input_message_content_fieldID;

addQuickReplyShortcutMessage::addQuickReplyShortcutMessage()
  : shortcut_name_()
  , reply_to_message_id_()
  , input_message_content_()
{}

addQuickReplyShortcutMessage::addQuickReplyShortcutMessage(string const &shortcut_name_, int53 reply_to_message_id_, object_ptr<InputMessageContent> &&input_message_content_)
  : shortcut_name_(shortcut_name_)
  , reply_to_message_id_(reply_to_message_id_)
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t addQuickReplyShortcutMessage::ID;

object_ptr<addQuickReplyShortcutMessage> addQuickReplyShortcutMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addQuickReplyShortcutMessage> res = make_object<addQuickReplyShortcutMessage>();
  res->shortcut_name_ = jni::fetch_string(env, p, res->shortcut_name_fieldID);
  res->reply_to_message_id_ = env->GetLongField(p, res->reply_to_message_id_fieldID);
  res->input_message_content_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->input_message_content_fieldID));
  return res;
}

void addQuickReplyShortcutMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddQuickReplyShortcutMessage");
    s.store_field("shortcutName", shortcut_name_);
    s.store_field("replyToMessageId", reply_to_message_id_);
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

addQuickReplyShortcutMessage::ReturnType addQuickReplyShortcutMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return quickReplyMessage::fetch(env, p);
}

void addQuickReplyShortcutMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddQuickReplyShortcutMessage").c_str());
    shortcut_name_fieldID = jni::get_field_id(env, Class, "shortcutName", "Ljava/lang/String;");
    reply_to_message_id_fieldID = jni::get_field_id(env, Class, "replyToMessageId", "J");
    input_message_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 addTextCompositionStyle::Class;
jfieldID addTextCompositionStyle::name_fieldID;

addTextCompositionStyle::addTextCompositionStyle()
  : name_()
{}

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

const std::int32_t addTextCompositionStyle::ID;

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

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

addTextCompositionStyle::ReturnType addTextCompositionStyle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass answerCustomQuery::Class;
jfieldID answerCustomQuery::custom_query_id_fieldID;
jfieldID answerCustomQuery::data_fieldID;

answerCustomQuery::answerCustomQuery()
  : custom_query_id_()
  , data_()
{}

answerCustomQuery::answerCustomQuery(int64 custom_query_id_, string const &data_)
  : custom_query_id_(custom_query_id_)
  , data_(data_)
{}

const std::int32_t answerCustomQuery::ID;

object_ptr<answerCustomQuery> answerCustomQuery::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<answerCustomQuery> res = make_object<answerCustomQuery>();
  res->custom_query_id_ = env->GetLongField(p, res->custom_query_id_fieldID);
  res->data_ = jni::fetch_string(env, p, res->data_fieldID);
  return res;
}

void answerCustomQuery::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AnswerCustomQuery");
    s.store_field("customQueryId", custom_query_id_);
    s.store_field("data", data_);
    s.store_class_end();
  }
}

answerCustomQuery::ReturnType answerCustomQuery::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void answerCustomQuery::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AnswerCustomQuery").c_str());
    custom_query_id_fieldID = jni::get_field_id(env, Class, "customQueryId", "J");
    data_fieldID = jni::get_field_id(env, Class, "data", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass cancelDownloadFile::Class;
jfieldID cancelDownloadFile::file_id_fieldID;
jfieldID cancelDownloadFile::only_if_pending_fieldID;

cancelDownloadFile::cancelDownloadFile()
  : file_id_()
  , only_if_pending_()
{}

cancelDownloadFile::cancelDownloadFile(int32 file_id_, bool only_if_pending_)
  : file_id_(file_id_)
  , only_if_pending_(only_if_pending_)
{}

const std::int32_t cancelDownloadFile::ID;

object_ptr<cancelDownloadFile> cancelDownloadFile::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<cancelDownloadFile> res = make_object<cancelDownloadFile>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->only_if_pending_ = (env->GetBooleanField(p, res->only_if_pending_fieldID) != 0);
  return res;
}

void cancelDownloadFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CancelDownloadFile");
    s.store_field("fileId", file_id_);
    s.store_field("onlyIfPending", only_if_pending_);
    s.store_class_end();
  }
}

cancelDownloadFile::ReturnType cancelDownloadFile::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void cancelDownloadFile::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CancelDownloadFile").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    only_if_pending_fieldID = jni::get_field_id(env, Class, "onlyIfPending", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass cancelPasswordReset::Class;

cancelPasswordReset::cancelPasswordReset() {
}

const std::int32_t cancelPasswordReset::ID;

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

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

cancelPasswordReset::ReturnType cancelPasswordReset::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass checkAuthenticationPasskey::Class;
jfieldID checkAuthenticationPasskey::credential_id_fieldID;
jfieldID checkAuthenticationPasskey::client_data_fieldID;
jfieldID checkAuthenticationPasskey::authenticator_data_fieldID;
jfieldID checkAuthenticationPasskey::signature_fieldID;
jfieldID checkAuthenticationPasskey::user_handle_fieldID;

checkAuthenticationPasskey::checkAuthenticationPasskey()
  : credential_id_()
  , client_data_()
  , authenticator_data_()
  , signature_()
  , user_handle_()
{}

checkAuthenticationPasskey::checkAuthenticationPasskey(string const &credential_id_, string const &client_data_, bytes const &authenticator_data_, bytes const &signature_, bytes const &user_handle_)
  : credential_id_(credential_id_)
  , client_data_(client_data_)
  , authenticator_data_(std::move(authenticator_data_))
  , signature_(std::move(signature_))
  , user_handle_(std::move(user_handle_))
{}

const std::int32_t checkAuthenticationPasskey::ID;

object_ptr<checkAuthenticationPasskey> checkAuthenticationPasskey::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkAuthenticationPasskey> res = make_object<checkAuthenticationPasskey>();
  res->credential_id_ = jni::fetch_string(env, p, res->credential_id_fieldID);
  res->client_data_ = jni::fetch_string(env, p, res->client_data_fieldID);
  res->authenticator_data_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->authenticator_data_fieldID));
  res->signature_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->signature_fieldID));
  res->user_handle_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->user_handle_fieldID));
  return res;
}

void checkAuthenticationPasskey::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckAuthenticationPasskey");
    s.store_field("credentialId", credential_id_);
    s.store_field("clientData", client_data_);
    s.store_bytes_field("authenticatorData", authenticator_data_);
    s.store_bytes_field("signature", signature_);
    s.store_bytes_field("userHandle", user_handle_);
    s.store_class_end();
  }
}

checkAuthenticationPasskey::ReturnType checkAuthenticationPasskey::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void checkAuthenticationPasskey::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CheckAuthenticationPasskey").c_str());
    credential_id_fieldID = jni::get_field_id(env, Class, "credentialId", "Ljava/lang/String;");
    client_data_fieldID = jni::get_field_id(env, Class, "clientData", "Ljava/lang/String;");
    authenticator_data_fieldID = jni::get_field_id(env, Class, "authenticatorData", "[B");
    signature_fieldID = jni::get_field_id(env, Class, "signature", "[B");
    user_handle_fieldID = jni::get_field_id(env, Class, "userHandle", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass checkChatUsername::Class;
jfieldID checkChatUsername::chat_id_fieldID;
jfieldID checkChatUsername::username_fieldID;

checkChatUsername::checkChatUsername()
  : chat_id_()
  , username_()
{}

checkChatUsername::checkChatUsername(int53 chat_id_, string const &username_)
  : chat_id_(chat_id_)
  , username_(username_)
{}

const std::int32_t checkChatUsername::ID;

object_ptr<checkChatUsername> checkChatUsername::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<checkChatUsername> res = make_object<checkChatUsername>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  return res;
}

void checkChatUsername::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CheckChatUsername");
    s.store_field("chatId", chat_id_);
    s.store_field("username", username_);
    s.store_class_end();
  }
}

checkChatUsername::ReturnType checkChatUsername::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return CheckChatUsernameResult::fetch(env, p);
}

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

jclass checkEmailAddressVerificationCode::Class;
jfieldID checkEmailAddressVerificationCode::code_fieldID;

checkEmailAddressVerificationCode::checkEmailAddressVerificationCode()
  : code_()
{}

checkEmailAddressVerificationCode::checkEmailAddressVerificationCode(string const &code_)
  : code_(code_)
{}

const std::int32_t checkEmailAddressVerificationCode::ID;

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

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

checkEmailAddressVerificationCode::ReturnType checkEmailAddressVerificationCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass closeSecretChat::Class;
jfieldID closeSecretChat::secret_chat_id_fieldID;

closeSecretChat::closeSecretChat()
  : secret_chat_id_()
{}

closeSecretChat::closeSecretChat(int32 secret_chat_id_)
  : secret_chat_id_(secret_chat_id_)
{}

const std::int32_t closeSecretChat::ID;

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

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

closeSecretChat::ReturnType closeSecretChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass closeStory::Class;
jfieldID closeStory::story_poster_chat_id_fieldID;
jfieldID closeStory::story_id_fieldID;

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

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

const std::int32_t closeStory::ID;

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

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

closeStory::ReturnType closeStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

confirmSession::confirmSession()
  : session_id_()
{}

confirmSession::confirmSession(int64 session_id_)
  : session_id_(session_id_)
{}

const std::int32_t confirmSession::ID;

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

void confirmSession::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConfirmSession");
    s.store_field("sessionId", session_id_);
    s.store_class_end();
  }
}

confirmSession::ReturnType confirmSession::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass createSecretChat::Class;
jfieldID createSecretChat::secret_chat_id_fieldID;

createSecretChat::createSecretChat()
  : secret_chat_id_()
{}

createSecretChat::createSecretChat(int32 secret_chat_id_)
  : secret_chat_id_(secret_chat_id_)
{}

const std::int32_t createSecretChat::ID;

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

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

createSecretChat::ReturnType createSecretChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chat::fetch(env, p);
}

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

jclass createTextCompositionStyle::Class;
jfieldID createTextCompositionStyle::title_fieldID;
jfieldID createTextCompositionStyle::custom_emoji_id_fieldID;
jfieldID createTextCompositionStyle::prompt_fieldID;
jfieldID createTextCompositionStyle::show_creator_fieldID;

createTextCompositionStyle::createTextCompositionStyle()
  : title_()
  , custom_emoji_id_()
  , prompt_()
  , show_creator_()
{}

createTextCompositionStyle::createTextCompositionStyle(string const &title_, int64 custom_emoji_id_, string const &prompt_, bool show_creator_)
  : title_(title_)
  , custom_emoji_id_(custom_emoji_id_)
  , prompt_(prompt_)
  , show_creator_(show_creator_)
{}

const std::int32_t createTextCompositionStyle::ID;

object_ptr<createTextCompositionStyle> createTextCompositionStyle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createTextCompositionStyle> res = make_object<createTextCompositionStyle>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->custom_emoji_id_ = env->GetLongField(p, res->custom_emoji_id_fieldID);
  res->prompt_ = jni::fetch_string(env, p, res->prompt_fieldID);
  res->show_creator_ = (env->GetBooleanField(p, res->show_creator_fieldID) != 0);
  return res;
}

void createTextCompositionStyle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateTextCompositionStyle");
    s.store_field("title", title_);
    s.store_field("customEmojiId", custom_emoji_id_);
    s.store_field("prompt", prompt_);
    s.store_field("showCreator", show_creator_);
    s.store_class_end();
  }
}

createTextCompositionStyle::ReturnType createTextCompositionStyle::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return textCompositionStyle::fetch(env, p);
}

void createTextCompositionStyle::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateTextCompositionStyle").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    custom_emoji_id_fieldID = jni::get_field_id(env, Class, "customEmojiId", "J");
    prompt_fieldID = jni::get_field_id(env, Class, "prompt", "Ljava/lang/String;");
    show_creator_fieldID = jni::get_field_id(env, Class, "showCreator", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass declineOauthRequest::Class;
jfieldID declineOauthRequest::url_fieldID;

declineOauthRequest::declineOauthRequest()
  : url_()
{}

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

const std::int32_t declineOauthRequest::ID;

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

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

declineOauthRequest::ReturnType declineOauthRequest::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass decryptGroupCallData::Class;
jfieldID decryptGroupCallData::group_call_id_fieldID;
jfieldID decryptGroupCallData::participant_id_fieldID;
jfieldID decryptGroupCallData::data_channel_fieldID;
jfieldID decryptGroupCallData::data_fieldID;

decryptGroupCallData::decryptGroupCallData()
  : group_call_id_()
  , participant_id_()
  , data_channel_()
  , data_()
{}

decryptGroupCallData::decryptGroupCallData(int32 group_call_id_, object_ptr<MessageSender> &&participant_id_, object_ptr<GroupCallDataChannel> &&data_channel_, bytes const &data_)
  : group_call_id_(group_call_id_)
  , participant_id_(std::move(participant_id_))
  , data_channel_(std::move(data_channel_))
  , data_(std::move(data_))
{}

const std::int32_t decryptGroupCallData::ID;

object_ptr<decryptGroupCallData> decryptGroupCallData::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<decryptGroupCallData> res = make_object<decryptGroupCallData>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->data_channel_ = jni::fetch_tl_object<GroupCallDataChannel>(env, jni::fetch_object(env, p, res->data_channel_fieldID));
  res->data_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->data_fieldID));
  return res;
}

void decryptGroupCallData::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DecryptGroupCallData");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("participantId", static_cast<const BaseObject *>(participant_id_.get()));
    s.store_object_field("dataChannel", static_cast<const BaseObject *>(data_channel_.get()));
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

decryptGroupCallData::ReturnType decryptGroupCallData::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return data::fetch(env, p);
}

void decryptGroupCallData::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DecryptGroupCallData").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    participant_id_fieldID = jni::get_field_id(env, Class, "participantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    data_channel_fieldID = jni::get_field_id(env, Class, "dataChannel", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GroupCallDataChannel;").c_str());
    data_fieldID = jni::get_field_id(env, Class, "data", "[B");
    return true;
  }();
  (void)is_inited;
}

jclass deleteChatFolderInviteLink::Class;
jfieldID deleteChatFolderInviteLink::chat_folder_id_fieldID;
jfieldID deleteChatFolderInviteLink::invite_link_fieldID;

deleteChatFolderInviteLink::deleteChatFolderInviteLink()
  : chat_folder_id_()
  , invite_link_()
{}

deleteChatFolderInviteLink::deleteChatFolderInviteLink(int32 chat_folder_id_, string const &invite_link_)
  : chat_folder_id_(chat_folder_id_)
  , invite_link_(invite_link_)
{}

const std::int32_t deleteChatFolderInviteLink::ID;

object_ptr<deleteChatFolderInviteLink> deleteChatFolderInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deleteChatFolderInviteLink> res = make_object<deleteChatFolderInviteLink>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_fieldID);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  return res;
}

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

deleteChatFolderInviteLink::ReturnType deleteChatFolderInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteFile::Class;
jfieldID deleteFile::file_id_fieldID;

deleteFile::deleteFile()
  : file_id_()
{}

deleteFile::deleteFile(int32 file_id_)
  : file_id_(file_id_)
{}

const std::int32_t deleteFile::ID;

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

void deleteFile::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteFile");
    s.store_field("fileId", file_id_);
    s.store_class_end();
  }
}

deleteFile::ReturnType deleteFile::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deletePollOption::Class;
jfieldID deletePollOption::chat_id_fieldID;
jfieldID deletePollOption::message_id_fieldID;
jfieldID deletePollOption::option_id_fieldID;

deletePollOption::deletePollOption()
  : chat_id_()
  , message_id_()
  , option_id_()
{}

deletePollOption::deletePollOption(int53 chat_id_, int53 message_id_, string const &option_id_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , option_id_(option_id_)
{}

const std::int32_t deletePollOption::ID;

object_ptr<deletePollOption> deletePollOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<deletePollOption> res = make_object<deletePollOption>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->option_id_ = jni::fetch_string(env, p, res->option_id_fieldID);
  return res;
}

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

deletePollOption::ReturnType deletePollOption::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteSavedOrderInfo::Class;

deleteSavedOrderInfo::deleteSavedOrderInfo() {
}

const std::int32_t deleteSavedOrderInfo::ID;

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

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

deleteSavedOrderInfo::ReturnType deleteSavedOrderInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass disableAllSupergroupUsernames::Class;
jfieldID disableAllSupergroupUsernames::supergroup_id_fieldID;

disableAllSupergroupUsernames::disableAllSupergroupUsernames()
  : supergroup_id_()
{}

disableAllSupergroupUsernames::disableAllSupergroupUsernames(int53 supergroup_id_)
  : supergroup_id_(supergroup_id_)
{}

const std::int32_t disableAllSupergroupUsernames::ID;

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

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

disableAllSupergroupUsernames::ReturnType disableAllSupergroupUsernames::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass disableProxy::Class;

disableProxy::disableProxy() {
}

const std::int32_t disableProxy::ID;

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

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

disableProxy::ReturnType disableProxy::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass getAuthenticationPasskeyParameters::Class;

getAuthenticationPasskeyParameters::getAuthenticationPasskeyParameters() {
}

const std::int32_t getAuthenticationPasskeyParameters::ID;

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

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

getAuthenticationPasskeyParameters::ReturnType getAuthenticationPasskeyParameters::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getAutoDownloadSettingsPresets::Class;

getAutoDownloadSettingsPresets::getAutoDownloadSettingsPresets() {
}

const std::int32_t getAutoDownloadSettingsPresets::ID;

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

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

getAutoDownloadSettingsPresets::ReturnType getAutoDownloadSettingsPresets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return autoDownloadSettingsPresets::fetch(env, p);
}

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

jclass getBotName::Class;
jfieldID getBotName::bot_user_id_fieldID;
jfieldID getBotName::language_code_fieldID;

getBotName::getBotName()
  : bot_user_id_()
  , language_code_()
{}

getBotName::getBotName(int53 bot_user_id_, string const &language_code_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
{}

const std::int32_t getBotName::ID;

object_ptr<getBotName> getBotName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBotName> res = make_object<getBotName>();
  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 getBotName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBotName");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    s.store_class_end();
  }
}

getBotName::ReturnType getBotName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

getBusinessConnectedBot::getBusinessConnectedBot() {
}

const std::int32_t getBusinessConnectedBot::ID;

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

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

getBusinessConnectedBot::ReturnType getBusinessConnectedBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessConnectedBot::fetch(env, p);
}

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

jclass getChatArchivedStories::Class;
jfieldID getChatArchivedStories::chat_id_fieldID;
jfieldID getChatArchivedStories::from_story_id_fieldID;
jfieldID getChatArchivedStories::limit_fieldID;

getChatArchivedStories::getChatArchivedStories()
  : chat_id_()
  , from_story_id_()
  , limit_()
{}

getChatArchivedStories::getChatArchivedStories(int53 chat_id_, int32 from_story_id_, int32 limit_)
  : chat_id_(chat_id_)
  , from_story_id_(from_story_id_)
  , limit_(limit_)
{}

const std::int32_t getChatArchivedStories::ID;

object_ptr<getChatArchivedStories> getChatArchivedStories::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatArchivedStories> res = make_object<getChatArchivedStories>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->from_story_id_ = env->GetIntField(p, res->from_story_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChatArchivedStories::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatArchivedStories");
    s.store_field("chatId", chat_id_);
    s.store_field("fromStoryId", from_story_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChatArchivedStories::ReturnType getChatArchivedStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stories::fetch(env, p);
}

void getChatArchivedStories::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatArchivedStories").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    from_story_id_fieldID = jni::get_field_id(env, Class, "fromStoryId", "I");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getChatBoostLevelFeatures::Class;
jfieldID getChatBoostLevelFeatures::is_channel_fieldID;
jfieldID getChatBoostLevelFeatures::level_fieldID;

getChatBoostLevelFeatures::getChatBoostLevelFeatures()
  : is_channel_()
  , level_()
{}

getChatBoostLevelFeatures::getChatBoostLevelFeatures(bool is_channel_, int32 level_)
  : is_channel_(is_channel_)
  , level_(level_)
{}

const std::int32_t getChatBoostLevelFeatures::ID;

object_ptr<getChatBoostLevelFeatures> getChatBoostLevelFeatures::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatBoostLevelFeatures> res = make_object<getChatBoostLevelFeatures>();
  res->is_channel_ = (env->GetBooleanField(p, res->is_channel_fieldID) != 0);
  res->level_ = env->GetIntField(p, res->level_fieldID);
  return res;
}

void getChatBoostLevelFeatures::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatBoostLevelFeatures");
    s.store_field("isChannel", is_channel_);
    s.store_field("level", level_);
    s.store_class_end();
  }
}

getChatBoostLevelFeatures::ReturnType getChatBoostLevelFeatures::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatBoostLevelFeatures::fetch(env, p);
}

void getChatBoostLevelFeatures::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatBoostLevelFeatures").c_str());
    is_channel_fieldID = jni::get_field_id(env, Class, "isChannel", "Z");
    level_fieldID = jni::get_field_id(env, Class, "level", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getChatBoosts::Class;
jfieldID getChatBoosts::chat_id_fieldID;
jfieldID getChatBoosts::only_gift_codes_fieldID;
jfieldID getChatBoosts::offset_fieldID;
jfieldID getChatBoosts::limit_fieldID;

getChatBoosts::getChatBoosts()
  : chat_id_()
  , only_gift_codes_()
  , offset_()
  , limit_()
{}

getChatBoosts::getChatBoosts(int53 chat_id_, bool only_gift_codes_, string const &offset_, int32 limit_)
  : chat_id_(chat_id_)
  , only_gift_codes_(only_gift_codes_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getChatBoosts::ID;

object_ptr<getChatBoosts> getChatBoosts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getChatBoosts> res = make_object<getChatBoosts>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->only_gift_codes_ = (env->GetBooleanField(p, res->only_gift_codes_fieldID) != 0);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getChatBoosts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatBoosts");
    s.store_field("chatId", chat_id_);
    s.store_field("onlyGiftCodes", only_gift_codes_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getChatBoosts::ReturnType getChatBoosts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundChatBoosts::fetch(env, p);
}

void getChatBoosts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetChatBoosts").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    only_gift_codes_fieldID = jni::get_field_id(env, Class, "onlyGiftCodes", "Z");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getChatFolder::Class;
jfieldID getChatFolder::chat_folder_id_fieldID;

getChatFolder::getChatFolder()
  : chat_folder_id_()
{}

getChatFolder::getChatFolder(int32 chat_folder_id_)
  : chat_folder_id_(chat_folder_id_)
{}

const std::int32_t getChatFolder::ID;

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

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

getChatFolder::ReturnType getChatFolder::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolder::fetch(env, p);
}

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

jclass getChatFolderInviteLinks::Class;
jfieldID getChatFolderInviteLinks::chat_folder_id_fieldID;

getChatFolderInviteLinks::getChatFolderInviteLinks()
  : chat_folder_id_()
{}

getChatFolderInviteLinks::getChatFolderInviteLinks(int32 chat_folder_id_)
  : chat_folder_id_(chat_folder_id_)
{}

const std::int32_t getChatFolderInviteLinks::ID;

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

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

getChatFolderInviteLinks::ReturnType getChatFolderInviteLinks::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolderInviteLinks::fetch(env, p);
}

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

jclass getChatListsToAddChat::Class;
jfieldID getChatListsToAddChat::chat_id_fieldID;

getChatListsToAddChat::getChatListsToAddChat()
  : chat_id_()
{}

getChatListsToAddChat::getChatListsToAddChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatListsToAddChat::ID;

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

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

getChatListsToAddChat::ReturnType getChatListsToAddChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatLists::fetch(env, p);
}

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

jclass getChatOwnerAfterLeaving::Class;
jfieldID getChatOwnerAfterLeaving::chat_id_fieldID;

getChatOwnerAfterLeaving::getChatOwnerAfterLeaving()
  : chat_id_()
{}

getChatOwnerAfterLeaving::getChatOwnerAfterLeaving(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatOwnerAfterLeaving::ID;

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

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

getChatOwnerAfterLeaving::ReturnType getChatOwnerAfterLeaving::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return user::fetch(env, p);
}

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

jclass getChatStatistics::Class;
jfieldID getChatStatistics::chat_id_fieldID;
jfieldID getChatStatistics::is_dark_fieldID;

getChatStatistics::getChatStatistics()
  : chat_id_()
  , is_dark_()
{}

getChatStatistics::getChatStatistics(int53 chat_id_, bool is_dark_)
  : chat_id_(chat_id_)
  , is_dark_(is_dark_)
{}

const std::int32_t getChatStatistics::ID;

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

void getChatStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetChatStatistics");
    s.store_field("chatId", chat_id_);
    s.store_field("isDark", is_dark_);
    s.store_class_end();
  }
}

getChatStatistics::ReturnType getChatStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ChatStatistics::fetch(env, p);
}

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

getCountryCode::getCountryCode() {
}

const std::int32_t getCountryCode::ID;

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

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

getCountryCode::ReturnType getCountryCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getDirectMessagesChatTopicHistory::Class;
jfieldID getDirectMessagesChatTopicHistory::chat_id_fieldID;
jfieldID getDirectMessagesChatTopicHistory::topic_id_fieldID;
jfieldID getDirectMessagesChatTopicHistory::from_message_id_fieldID;
jfieldID getDirectMessagesChatTopicHistory::offset_fieldID;
jfieldID getDirectMessagesChatTopicHistory::limit_fieldID;

getDirectMessagesChatTopicHistory::getDirectMessagesChatTopicHistory()
  : chat_id_()
  , topic_id_()
  , from_message_id_()
  , offset_()
  , limit_()
{}

getDirectMessagesChatTopicHistory::getDirectMessagesChatTopicHistory(int53 chat_id_, int53 topic_id_, int53 from_message_id_, int32 offset_, int32 limit_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
  , from_message_id_(from_message_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getDirectMessagesChatTopicHistory::ID;

object_ptr<getDirectMessagesChatTopicHistory> getDirectMessagesChatTopicHistory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getDirectMessagesChatTopicHistory> res = make_object<getDirectMessagesChatTopicHistory>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->topic_id_ = env->GetLongField(p, res->topic_id_fieldID);
  res->from_message_id_ = env->GetLongField(p, res->from_message_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getDirectMessagesChatTopicHistory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetDirectMessagesChatTopicHistory");
    s.store_field("chatId", chat_id_);
    s.store_field("topicId", topic_id_);
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getDirectMessagesChatTopicHistory::ReturnType getDirectMessagesChatTopicHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return messages::fetch(env, p);
}

void getDirectMessagesChatTopicHistory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetDirectMessagesChatTopicHistory").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    topic_id_fieldID = jni::get_field_id(env, Class, "topicId", "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 getGiftAuctionState::Class;
jfieldID getGiftAuctionState::auction_id_fieldID;

getGiftAuctionState::getGiftAuctionState()
  : auction_id_()
{}

getGiftAuctionState::getGiftAuctionState(string const &auction_id_)
  : auction_id_(auction_id_)
{}

const std::int32_t getGiftAuctionState::ID;

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

void getGiftAuctionState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGiftAuctionState");
    s.store_field("auctionId", auction_id_);
    s.store_class_end();
  }
}

getGiftAuctionState::ReturnType getGiftAuctionState::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftAuctionState::fetch(env, p);
}

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

jclass getImportedContactCount::Class;

getImportedContactCount::getImportedContactCount() {
}

const std::int32_t getImportedContactCount::ID;

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

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

getImportedContactCount::ReturnType getImportedContactCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return count::fetch(env, p);
}

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

jclass getInternalLink::Class;
jfieldID getInternalLink::type_fieldID;
jfieldID getInternalLink::is_http_fieldID;

getInternalLink::getInternalLink()
  : type_()
  , is_http_()
{}

getInternalLink::getInternalLink(object_ptr<InternalLinkType> &&type_, bool is_http_)
  : type_(std::move(type_))
  , is_http_(is_http_)
{}

const std::int32_t getInternalLink::ID;

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

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

getInternalLink::ReturnType getInternalLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void getInternalLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetInternalLink").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InternalLinkType;").c_str());
    is_http_fieldID = jni::get_field_id(env, Class, "isHttp", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getManagedBotAccessSettings::Class;
jfieldID getManagedBotAccessSettings::bot_user_id_fieldID;

getManagedBotAccessSettings::getManagedBotAccessSettings()
  : bot_user_id_()
{}

getManagedBotAccessSettings::getManagedBotAccessSettings(int53 bot_user_id_)
  : bot_user_id_(bot_user_id_)
{}

const std::int32_t getManagedBotAccessSettings::ID;

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

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

getManagedBotAccessSettings::ReturnType getManagedBotAccessSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return botAccessSettings::fetch(env, p);
}

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

jclass getMarkdownText::Class;
jfieldID getMarkdownText::text_fieldID;

getMarkdownText::getMarkdownText()
  : text_()
{}

getMarkdownText::getMarkdownText(object_ptr<formattedText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t getMarkdownText::ID;

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

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

getMarkdownText::ReturnType getMarkdownText::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return formattedText::fetch(env, p);
}

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

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

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

const std::int32_t getMessageLocally::ID;

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

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

getMessageLocally::ReturnType getMessageLocally::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

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

getPremiumGiftPaymentOptions::getPremiumGiftPaymentOptions() {
}

const std::int32_t getPremiumGiftPaymentOptions::ID;

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

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

getPremiumGiftPaymentOptions::ReturnType getPremiumGiftPaymentOptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return premiumGiftPaymentOptions::fetch(env, p);
}

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

jclass getPreparedInlineMessage::Class;
jfieldID getPreparedInlineMessage::bot_user_id_fieldID;
jfieldID getPreparedInlineMessage::prepared_message_id_fieldID;

getPreparedInlineMessage::getPreparedInlineMessage()
  : bot_user_id_()
  , prepared_message_id_()
{}

getPreparedInlineMessage::getPreparedInlineMessage(int53 bot_user_id_, string const &prepared_message_id_)
  : bot_user_id_(bot_user_id_)
  , prepared_message_id_(prepared_message_id_)
{}

const std::int32_t getPreparedInlineMessage::ID;

object_ptr<getPreparedInlineMessage> getPreparedInlineMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPreparedInlineMessage> res = make_object<getPreparedInlineMessage>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->prepared_message_id_ = jni::fetch_string(env, p, res->prepared_message_id_fieldID);
  return res;
}

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

getPreparedInlineMessage::ReturnType getPreparedInlineMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return preparedInlineMessage::fetch(env, p);
}

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

jclass getSavedMessagesTags::Class;
jfieldID getSavedMessagesTags::saved_messages_topic_id_fieldID;

getSavedMessagesTags::getSavedMessagesTags()
  : saved_messages_topic_id_()
{}

getSavedMessagesTags::getSavedMessagesTags(int53 saved_messages_topic_id_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
{}

const std::int32_t getSavedMessagesTags::ID;

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

void getSavedMessagesTags::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSavedMessagesTags");
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_class_end();
  }
}

getSavedMessagesTags::ReturnType getSavedMessagesTags::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return savedMessagesTags::fetch(env, p);
}

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

jclass getSavedMessagesTopicMessageByDate::Class;
jfieldID getSavedMessagesTopicMessageByDate::saved_messages_topic_id_fieldID;
jfieldID getSavedMessagesTopicMessageByDate::date_fieldID;

getSavedMessagesTopicMessageByDate::getSavedMessagesTopicMessageByDate()
  : saved_messages_topic_id_()
  , date_()
{}

getSavedMessagesTopicMessageByDate::getSavedMessagesTopicMessageByDate(int53 saved_messages_topic_id_, int32 date_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
  , date_(date_)
{}

const std::int32_t getSavedMessagesTopicMessageByDate::ID;

object_ptr<getSavedMessagesTopicMessageByDate> getSavedMessagesTopicMessageByDate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getSavedMessagesTopicMessageByDate> res = make_object<getSavedMessagesTopicMessageByDate>();
  res->saved_messages_topic_id_ = env->GetLongField(p, res->saved_messages_topic_id_fieldID);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  return res;
}

void getSavedMessagesTopicMessageByDate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSavedMessagesTopicMessageByDate");
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_field("date", date_);
    s.store_class_end();
  }
}

getSavedMessagesTopicMessageByDate::ReturnType getSavedMessagesTopicMessageByDate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return message::fetch(env, p);
}

void getSavedMessagesTopicMessageByDate::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetSavedMessagesTopicMessageByDate").c_str());
    saved_messages_topic_id_fieldID = jni::get_field_id(env, Class, "savedMessagesTopicId", "J");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    return true;
  }();
  (void)is_inited;
}

jclass getSecretChat::Class;
jfieldID getSecretChat::secret_chat_id_fieldID;

getSecretChat::getSecretChat()
  : secret_chat_id_()
{}

getSecretChat::getSecretChat(int32 secret_chat_id_)
  : secret_chat_id_(secret_chat_id_)
{}

const std::int32_t getSecretChat::ID;

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

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

getSecretChat::ReturnType getSecretChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return secretChat::fetch(env, p);
}

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

jclass getStarGiveawayPaymentOptions::Class;

getStarGiveawayPaymentOptions::getStarGiveawayPaymentOptions() {
}

const std::int32_t getStarGiveawayPaymentOptions::ID;

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

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

getStarGiveawayPaymentOptions::ReturnType getStarGiveawayPaymentOptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starGiveawayPaymentOptions::fetch(env, p);
}

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

jclass getStarRevenueStatistics::Class;
jfieldID getStarRevenueStatistics::owner_id_fieldID;
jfieldID getStarRevenueStatistics::is_dark_fieldID;

getStarRevenueStatistics::getStarRevenueStatistics()
  : owner_id_()
  , is_dark_()
{}

getStarRevenueStatistics::getStarRevenueStatistics(object_ptr<MessageSender> &&owner_id_, bool is_dark_)
  : owner_id_(std::move(owner_id_))
  , is_dark_(is_dark_)
{}

const std::int32_t getStarRevenueStatistics::ID;

object_ptr<getStarRevenueStatistics> getStarRevenueStatistics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStarRevenueStatistics> res = make_object<getStarRevenueStatistics>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->is_dark_ = (env->GetBooleanField(p, res->is_dark_fieldID) != 0);
  return res;
}

void getStarRevenueStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStarRevenueStatistics");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("isDark", is_dark_);
    s.store_class_end();
  }
}

getStarRevenueStatistics::ReturnType getStarRevenueStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starRevenueStatistics::fetch(env, p);
}

void getStarRevenueStatistics::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStarRevenueStatistics").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    is_dark_fieldID = jni::get_field_id(env, Class, "isDark", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getStarWithdrawalUrl::Class;
jfieldID getStarWithdrawalUrl::owner_id_fieldID;
jfieldID getStarWithdrawalUrl::star_count_fieldID;
jfieldID getStarWithdrawalUrl::password_fieldID;

getStarWithdrawalUrl::getStarWithdrawalUrl()
  : owner_id_()
  , star_count_()
  , password_()
{}

getStarWithdrawalUrl::getStarWithdrawalUrl(object_ptr<MessageSender> &&owner_id_, int53 star_count_, string const &password_)
  : owner_id_(std::move(owner_id_))
  , star_count_(star_count_)
  , password_(password_)
{}

const std::int32_t getStarWithdrawalUrl::ID;

object_ptr<getStarWithdrawalUrl> getStarWithdrawalUrl::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStarWithdrawalUrl> res = make_object<getStarWithdrawalUrl>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void getStarWithdrawalUrl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStarWithdrawalUrl");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("starCount", star_count_);
    s.store_field("password", password_);
    s.store_class_end();
  }
}

getStarWithdrawalUrl::ReturnType getStarWithdrawalUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

void getStarWithdrawalUrl::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStarWithdrawalUrl").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    star_count_fieldID = jni::get_field_id(env, Class, "starCount", "J");
    password_fieldID = jni::get_field_id(env, Class, "password", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getStickerOutlineSvgPath::Class;
jfieldID getStickerOutlineSvgPath::sticker_file_id_fieldID;
jfieldID getStickerOutlineSvgPath::for_animated_emoji_fieldID;
jfieldID getStickerOutlineSvgPath::for_clicked_animated_emoji_message_fieldID;

getStickerOutlineSvgPath::getStickerOutlineSvgPath()
  : sticker_file_id_()
  , for_animated_emoji_()
  , for_clicked_animated_emoji_message_()
{}

getStickerOutlineSvgPath::getStickerOutlineSvgPath(int32 sticker_file_id_, bool for_animated_emoji_, bool for_clicked_animated_emoji_message_)
  : sticker_file_id_(sticker_file_id_)
  , for_animated_emoji_(for_animated_emoji_)
  , for_clicked_animated_emoji_message_(for_clicked_animated_emoji_message_)
{}

const std::int32_t getStickerOutlineSvgPath::ID;

object_ptr<getStickerOutlineSvgPath> getStickerOutlineSvgPath::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStickerOutlineSvgPath> res = make_object<getStickerOutlineSvgPath>();
  res->sticker_file_id_ = env->GetIntField(p, res->sticker_file_id_fieldID);
  res->for_animated_emoji_ = (env->GetBooleanField(p, res->for_animated_emoji_fieldID) != 0);
  res->for_clicked_animated_emoji_message_ = (env->GetBooleanField(p, res->for_clicked_animated_emoji_message_fieldID) != 0);
  return res;
}

void getStickerOutlineSvgPath::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStickerOutlineSvgPath");
    s.store_field("stickerFileId", sticker_file_id_);
    s.store_field("forAnimatedEmoji", for_animated_emoji_);
    s.store_field("forClickedAnimatedEmojiMessage", for_clicked_animated_emoji_message_);
    s.store_class_end();
  }
}

getStickerOutlineSvgPath::ReturnType getStickerOutlineSvgPath::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

void getStickerOutlineSvgPath::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetStickerOutlineSvgPath").c_str());
    sticker_file_id_fieldID = jni::get_field_id(env, Class, "stickerFileId", "I");
    for_animated_emoji_fieldID = jni::get_field_id(env, Class, "forAnimatedEmoji", "Z");
    for_clicked_animated_emoji_message_fieldID = jni::get_field_id(env, Class, "forClickedAnimatedEmojiMessage", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getTextCompositionStyleExample::Class;
jfieldID getTextCompositionStyleExample::name_fieldID;
jfieldID getTextCompositionStyleExample::example_number_fieldID;

getTextCompositionStyleExample::getTextCompositionStyleExample()
  : name_()
  , example_number_()
{}

getTextCompositionStyleExample::getTextCompositionStyleExample(string const &name_, int32 example_number_)
  : name_(name_)
  , example_number_(example_number_)
{}

const std::int32_t getTextCompositionStyleExample::ID;

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

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

getTextCompositionStyleExample::ReturnType getTextCompositionStyleExample::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return textCompositionStyleExample::fetch(env, p);
}

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

jclass getThemeParametersJsonString::Class;
jfieldID getThemeParametersJsonString::theme_fieldID;

getThemeParametersJsonString::getThemeParametersJsonString()
  : theme_()
{}

getThemeParametersJsonString::getThemeParametersJsonString(object_ptr<themeParameters> &&theme_)
  : theme_(std::move(theme_))
{}

const std::int32_t getThemeParametersJsonString::ID;

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

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

getThemeParametersJsonString::ReturnType getThemeParametersJsonString::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getTonRevenueStatistics::Class;
jfieldID getTonRevenueStatistics::is_dark_fieldID;

getTonRevenueStatistics::getTonRevenueStatistics()
  : is_dark_()
{}

getTonRevenueStatistics::getTonRevenueStatistics(bool is_dark_)
  : is_dark_(is_dark_)
{}

const std::int32_t getTonRevenueStatistics::ID;

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

void getTonRevenueStatistics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetTonRevenueStatistics");
    s.store_field("isDark", is_dark_);
    s.store_class_end();
  }
}

getTonRevenueStatistics::ReturnType getTonRevenueStatistics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return tonRevenueStatistics::fetch(env, p);
}

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

jclass getUpgradedGiftVariants::Class;
jfieldID getUpgradedGiftVariants::regular_gift_id_fieldID;
jfieldID getUpgradedGiftVariants::return_upgrade_models_fieldID;
jfieldID getUpgradedGiftVariants::return_craft_models_fieldID;

getUpgradedGiftVariants::getUpgradedGiftVariants()
  : regular_gift_id_()
  , return_upgrade_models_()
  , return_craft_models_()
{}

getUpgradedGiftVariants::getUpgradedGiftVariants(int64 regular_gift_id_, bool return_upgrade_models_, bool return_craft_models_)
  : regular_gift_id_(regular_gift_id_)
  , return_upgrade_models_(return_upgrade_models_)
  , return_craft_models_(return_craft_models_)
{}

const std::int32_t getUpgradedGiftVariants::ID;

object_ptr<getUpgradedGiftVariants> getUpgradedGiftVariants::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getUpgradedGiftVariants> res = make_object<getUpgradedGiftVariants>();
  res->regular_gift_id_ = env->GetLongField(p, res->regular_gift_id_fieldID);
  res->return_upgrade_models_ = (env->GetBooleanField(p, res->return_upgrade_models_fieldID) != 0);
  res->return_craft_models_ = (env->GetBooleanField(p, res->return_craft_models_fieldID) != 0);
  return res;
}

void getUpgradedGiftVariants::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetUpgradedGiftVariants");
    s.store_field("regularGiftId", regular_gift_id_);
    s.store_field("returnUpgradeModels", return_upgrade_models_);
    s.store_field("returnCraftModels", return_craft_models_);
    s.store_class_end();
  }
}

getUpgradedGiftVariants::ReturnType getUpgradedGiftVariants::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftUpgradeVariants::fetch(env, p);
}

void getUpgradedGiftVariants::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetUpgradedGiftVariants").c_str());
    regular_gift_id_fieldID = jni::get_field_id(env, Class, "regularGiftId", "J");
    return_upgrade_models_fieldID = jni::get_field_id(env, Class, "returnUpgradeModels", "Z");
    return_craft_models_fieldID = jni::get_field_id(env, Class, "returnCraftModels", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass getUpgradedGiftsPromotionalAnimation::Class;

getUpgradedGiftsPromotionalAnimation::getUpgradedGiftsPromotionalAnimation() {
}

const std::int32_t getUpgradedGiftsPromotionalAnimation::ID;

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

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

getUpgradedGiftsPromotionalAnimation::ReturnType getUpgradedGiftsPromotionalAnimation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return animation::fetch(env, p);
}

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

jclass getVideoMessageAdvertisements::Class;
jfieldID getVideoMessageAdvertisements::chat_id_fieldID;
jfieldID getVideoMessageAdvertisements::message_id_fieldID;

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

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

const std::int32_t getVideoMessageAdvertisements::ID;

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

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

getVideoMessageAdvertisements::ReturnType getVideoMessageAdvertisements::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return videoMessageAdvertisements::fetch(env, p);
}

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

getWebPageInstantView::getWebPageInstantView()
  : url_()
  , only_local_()
{}

getWebPageInstantView::getWebPageInstantView(string const &url_, bool only_local_)
  : url_(url_)
  , only_local_(only_local_)
{}

const std::int32_t getWebPageInstantView::ID;

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

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

getWebPageInstantView::ReturnType getWebPageInstantView::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return webPageInstantView::fetch(env, p);
}

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

jclass joinVideoChat::Class;
jfieldID joinVideoChat::group_call_id_fieldID;
jfieldID joinVideoChat::participant_id_fieldID;
jfieldID joinVideoChat::join_parameters_fieldID;
jfieldID joinVideoChat::invite_hash_fieldID;

joinVideoChat::joinVideoChat()
  : group_call_id_()
  , participant_id_()
  , join_parameters_()
  , invite_hash_()
{}

joinVideoChat::joinVideoChat(int32 group_call_id_, object_ptr<MessageSender> &&participant_id_, object_ptr<groupCallJoinParameters> &&join_parameters_, string const &invite_hash_)
  : group_call_id_(group_call_id_)
  , participant_id_(std::move(participant_id_))
  , join_parameters_(std::move(join_parameters_))
  , invite_hash_(invite_hash_)
{}

const std::int32_t joinVideoChat::ID;

object_ptr<joinVideoChat> joinVideoChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<joinVideoChat> res = make_object<joinVideoChat>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->join_parameters_ = jni::fetch_tl_object<groupCallJoinParameters>(env, jni::fetch_object(env, p, res->join_parameters_fieldID));
  res->invite_hash_ = jni::fetch_string(env, p, res->invite_hash_fieldID);
  return res;
}

void joinVideoChat::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "JoinVideoChat");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("participantId", static_cast<const BaseObject *>(participant_id_.get()));
    s.store_object_field("joinParameters", static_cast<const BaseObject *>(join_parameters_.get()));
    s.store_field("inviteHash", invite_hash_);
    s.store_class_end();
  }
}

joinVideoChat::ReturnType joinVideoChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

void joinVideoChat::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$JoinVideoChat").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    participant_id_fieldID = jni::get_field_id(env, Class, "participantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    join_parameters_fieldID = jni::get_field_id(env, Class, "joinParameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GroupCallJoinParameters;").c_str());
    invite_hash_fieldID = jni::get_field_id(env, Class, "inviteHash", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass loadDirectMessagesChatTopics::Class;
jfieldID loadDirectMessagesChatTopics::chat_id_fieldID;
jfieldID loadDirectMessagesChatTopics::limit_fieldID;

loadDirectMessagesChatTopics::loadDirectMessagesChatTopics()
  : chat_id_()
  , limit_()
{}

loadDirectMessagesChatTopics::loadDirectMessagesChatTopics(int53 chat_id_, int32 limit_)
  : chat_id_(chat_id_)
  , limit_(limit_)
{}

const std::int32_t loadDirectMessagesChatTopics::ID;

object_ptr<loadDirectMessagesChatTopics> loadDirectMessagesChatTopics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<loadDirectMessagesChatTopics> res = make_object<loadDirectMessagesChatTopics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void loadDirectMessagesChatTopics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LoadDirectMessagesChatTopics");
    s.store_field("chatId", chat_id_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

loadDirectMessagesChatTopics::ReturnType loadDirectMessagesChatTopics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

loadSavedMessagesTopics::loadSavedMessagesTopics()
  : limit_()
{}

loadSavedMessagesTopics::loadSavedMessagesTopics(int32 limit_)
  : limit_(limit_)
{}

const std::int32_t loadSavedMessagesTopics::ID;

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

void loadSavedMessagesTopics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "LoadSavedMessagesTopics");
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

loadSavedMessagesTopics::ReturnType loadSavedMessagesTopics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass logOut::Class;

logOut::logOut() {
}

const std::int32_t logOut::ID;

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

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

logOut::ReturnType logOut::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass processChatJoinRequests::Class;
jfieldID processChatJoinRequests::chat_id_fieldID;
jfieldID processChatJoinRequests::invite_link_fieldID;
jfieldID processChatJoinRequests::approve_fieldID;

processChatJoinRequests::processChatJoinRequests()
  : chat_id_()
  , invite_link_()
  , approve_()
{}

processChatJoinRequests::processChatJoinRequests(int53 chat_id_, string const &invite_link_, bool approve_)
  : chat_id_(chat_id_)
  , invite_link_(invite_link_)
  , approve_(approve_)
{}

const std::int32_t processChatJoinRequests::ID;

object_ptr<processChatJoinRequests> processChatJoinRequests::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<processChatJoinRequests> res = make_object<processChatJoinRequests>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->approve_ = (env->GetBooleanField(p, res->approve_fieldID) != 0);
  return res;
}

void processChatJoinRequests::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProcessChatJoinRequests");
    s.store_field("chatId", chat_id_);
    s.store_field("inviteLink", invite_link_);
    s.store_field("approve", approve_);
    s.store_class_end();
  }
}

processChatJoinRequests::ReturnType processChatJoinRequests::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void processChatJoinRequests::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ProcessChatJoinRequests").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    approve_fieldID = jni::get_field_id(env, Class, "approve", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass readAllForumTopicMentions::Class;
jfieldID readAllForumTopicMentions::chat_id_fieldID;
jfieldID readAllForumTopicMentions::forum_topic_id_fieldID;

readAllForumTopicMentions::readAllForumTopicMentions()
  : chat_id_()
  , forum_topic_id_()
{}

readAllForumTopicMentions::readAllForumTopicMentions(int53 chat_id_, int32 forum_topic_id_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
{}

const std::int32_t readAllForumTopicMentions::ID;

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

readAllForumTopicMentions::ReturnType readAllForumTopicMentions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

removeFavoriteSticker::removeFavoriteSticker()
  : sticker_()
{}

removeFavoriteSticker::removeFavoriteSticker(object_ptr<InputFile> &&sticker_)
  : sticker_(std::move(sticker_))
{}

const std::int32_t removeFavoriteSticker::ID;

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

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

removeFavoriteSticker::ReturnType removeFavoriteSticker::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeLoginPasskey::Class;
jfieldID removeLoginPasskey::passkey_id_fieldID;

removeLoginPasskey::removeLoginPasskey()
  : passkey_id_()
{}

removeLoginPasskey::removeLoginPasskey(string const &passkey_id_)
  : passkey_id_(passkey_id_)
{}

const std::int32_t removeLoginPasskey::ID;

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

void removeLoginPasskey::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveLoginPasskey");
    s.store_field("passkeyId", passkey_id_);
    s.store_class_end();
  }
}

removeLoginPasskey::ReturnType removeLoginPasskey::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeSavedAnimation::Class;
jfieldID removeSavedAnimation::animation_fieldID;

removeSavedAnimation::removeSavedAnimation()
  : animation_()
{}

removeSavedAnimation::removeSavedAnimation(object_ptr<InputFile> &&animation_)
  : animation_(std::move(animation_))
{}

const std::int32_t removeSavedAnimation::ID;

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

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

removeSavedAnimation::ReturnType removeSavedAnimation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reorderActiveUsernames::Class;
jfieldID reorderActiveUsernames::usernames_fieldID;

reorderActiveUsernames::reorderActiveUsernames()
  : usernames_()
{}

reorderActiveUsernames::reorderActiveUsernames(array<string> &&usernames_)
  : usernames_(std::move(usernames_))
{}

const std::int32_t reorderActiveUsernames::ID;

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

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

reorderActiveUsernames::ReturnType reorderActiveUsernames::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass replaceVideoChatRtmpUrl::Class;
jfieldID replaceVideoChatRtmpUrl::chat_id_fieldID;

replaceVideoChatRtmpUrl::replaceVideoChatRtmpUrl()
  : chat_id_()
{}

replaceVideoChatRtmpUrl::replaceVideoChatRtmpUrl(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t replaceVideoChatRtmpUrl::ID;

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

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

replaceVideoChatRtmpUrl::ReturnType replaceVideoChatRtmpUrl::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return rtmpUrl::fetch(env, p);
}

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

jclass requestQrCodeAuthentication::Class;
jfieldID requestQrCodeAuthentication::other_user_ids_fieldID;

requestQrCodeAuthentication::requestQrCodeAuthentication()
  : other_user_ids_()
{}

requestQrCodeAuthentication::requestQrCodeAuthentication(array<int53> &&other_user_ids_)
  : other_user_ids_(std::move(other_user_ids_))
{}

const std::int32_t requestQrCodeAuthentication::ID;

object_ptr<requestQrCodeAuthentication> requestQrCodeAuthentication::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<requestQrCodeAuthentication> res = make_object<requestQrCodeAuthentication>();
  res->other_user_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->other_user_ids_fieldID));
  return res;
}

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

requestQrCodeAuthentication::ReturnType requestQrCodeAuthentication::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass resendLoginEmailAddressCode::Class;

resendLoginEmailAddressCode::resendLoginEmailAddressCode() {
}

const std::int32_t resendLoginEmailAddressCode::ID;

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

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

resendLoginEmailAddressCode::ReturnType resendLoginEmailAddressCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emailAddressAuthenticationCodeInfo::fetch(env, p);
}

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

jclass resetInstalledBackgrounds::Class;

resetInstalledBackgrounds::resetInstalledBackgrounds() {
}

const std::int32_t resetInstalledBackgrounds::ID;

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

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

resetInstalledBackgrounds::ReturnType resetInstalledBackgrounds::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reuseStarSubscription::Class;
jfieldID reuseStarSubscription::subscription_id_fieldID;

reuseStarSubscription::reuseStarSubscription()
  : subscription_id_()
{}

reuseStarSubscription::reuseStarSubscription(string const &subscription_id_)
  : subscription_id_(subscription_id_)
{}

const std::int32_t reuseStarSubscription::ID;

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

void reuseStarSubscription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReuseStarSubscription");
    s.store_field("subscriptionId", subscription_id_);
    s.store_class_end();
  }
}

reuseStarSubscription::ReturnType reuseStarSubscription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass searchPublicStoriesByTag::Class;
jfieldID searchPublicStoriesByTag::story_poster_chat_id_fieldID;
jfieldID searchPublicStoriesByTag::tag_fieldID;
jfieldID searchPublicStoriesByTag::offset_fieldID;
jfieldID searchPublicStoriesByTag::limit_fieldID;

searchPublicStoriesByTag::searchPublicStoriesByTag()
  : story_poster_chat_id_()
  , tag_()
  , offset_()
  , limit_()
{}

searchPublicStoriesByTag::searchPublicStoriesByTag(int53 story_poster_chat_id_, string const &tag_, string const &offset_, int32 limit_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , tag_(tag_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchPublicStoriesByTag::ID;

object_ptr<searchPublicStoriesByTag> searchPublicStoriesByTag::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchPublicStoriesByTag> res = make_object<searchPublicStoriesByTag>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->tag_ = jni::fetch_string(env, p, res->tag_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchPublicStoriesByTag::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchPublicStoriesByTag");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("tag", tag_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchPublicStoriesByTag::ReturnType searchPublicStoriesByTag::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundStories::fetch(env, p);
}

void searchPublicStoriesByTag::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchPublicStoriesByTag").c_str());
    story_poster_chat_id_fieldID = jni::get_field_id(env, Class, "storyPosterChatId", "J");
    tag_fieldID = jni::get_field_id(env, Class, "tag", "Ljava/lang/String;");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchSavedMessages::Class;
jfieldID searchSavedMessages::saved_messages_topic_id_fieldID;
jfieldID searchSavedMessages::tag_fieldID;
jfieldID searchSavedMessages::query_fieldID;
jfieldID searchSavedMessages::from_message_id_fieldID;
jfieldID searchSavedMessages::offset_fieldID;
jfieldID searchSavedMessages::limit_fieldID;

searchSavedMessages::searchSavedMessages()
  : saved_messages_topic_id_()
  , tag_()
  , query_()
  , from_message_id_()
  , offset_()
  , limit_()
{}

searchSavedMessages::searchSavedMessages(int53 saved_messages_topic_id_, object_ptr<ReactionType> &&tag_, string const &query_, int53 from_message_id_, int32 offset_, int32 limit_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
  , tag_(std::move(tag_))
  , query_(query_)
  , from_message_id_(from_message_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchSavedMessages::ID;

object_ptr<searchSavedMessages> searchSavedMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchSavedMessages> res = make_object<searchSavedMessages>();
  res->saved_messages_topic_id_ = env->GetLongField(p, res->saved_messages_topic_id_fieldID);
  res->tag_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->tag_fieldID));
  res->query_ = jni::fetch_string(env, p, res->query_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 searchSavedMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchSavedMessages");
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_object_field("tag", static_cast<const BaseObject *>(tag_.get()));
    s.store_field("query", query_);
    s.store_field("fromMessageId", from_message_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchSavedMessages::ReturnType searchSavedMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundChatMessages::fetch(env, p);
}

void searchSavedMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchSavedMessages").c_str());
    saved_messages_topic_id_fieldID = jni::get_field_id(env, Class, "savedMessagesTopicId", "J");
    tag_fieldID = jni::get_field_id(env, Class, "tag", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionType;").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    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 searchStickerSet::Class;
jfieldID searchStickerSet::name_fieldID;
jfieldID searchStickerSet::ignore_cache_fieldID;

searchStickerSet::searchStickerSet()
  : name_()
  , ignore_cache_()
{}

searchStickerSet::searchStickerSet(string const &name_, bool ignore_cache_)
  : name_(name_)
  , ignore_cache_(ignore_cache_)
{}

const std::int32_t searchStickerSet::ID;

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

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

searchStickerSet::ReturnType searchStickerSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSet::fetch(env, p);
}

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

jclass searchUserByToken::Class;
jfieldID searchUserByToken::token_fieldID;

searchUserByToken::searchUserByToken()
  : token_()
{}

searchUserByToken::searchUserByToken(string const &token_)
  : token_(token_)
{}

const std::int32_t searchUserByToken::ID;

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

void searchUserByToken::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchUserByToken");
    s.store_field("token", token_);
    s.store_class_end();
  }
}

searchUserByToken::ReturnType searchUserByToken::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return user::fetch(env, p);
}

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

jclass sendCallLog::Class;
jfieldID sendCallLog::call_id_fieldID;
jfieldID sendCallLog::log_file_fieldID;

sendCallLog::sendCallLog()
  : call_id_()
  , log_file_()
{}

sendCallLog::sendCallLog(object_ptr<InputCall> &&call_id_, object_ptr<InputFile> &&log_file_)
  : call_id_(std::move(call_id_))
  , log_file_(std::move(log_file_))
{}

const std::int32_t sendCallLog::ID;

object_ptr<sendCallLog> sendCallLog::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendCallLog> res = make_object<sendCallLog>();
  res->call_id_ = jni::fetch_tl_object<InputCall>(env, jni::fetch_object(env, p, res->call_id_fieldID));
  res->log_file_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->log_file_fieldID));
  return res;
}

void sendCallLog::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendCallLog");
    s.store_object_field("callId", static_cast<const BaseObject *>(call_id_.get()));
    s.store_object_field("logFile", static_cast<const BaseObject *>(log_file_.get()));
    s.store_class_end();
  }
}

sendCallLog::ReturnType sendCallLog::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendCallLog::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendCallLog").c_str());
    call_id_fieldID = jni::get_field_id(env, Class, "callId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputCall;").c_str());
    log_file_fieldID = jni::get_field_id(env, Class, "logFile", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass sendGroupCallMessage::Class;
jfieldID sendGroupCallMessage::group_call_id_fieldID;
jfieldID sendGroupCallMessage::text_fieldID;
jfieldID sendGroupCallMessage::paid_message_star_count_fieldID;

sendGroupCallMessage::sendGroupCallMessage()
  : group_call_id_()
  , text_()
  , paid_message_star_count_()
{}

sendGroupCallMessage::sendGroupCallMessage(int32 group_call_id_, object_ptr<formattedText> &&text_, int53 paid_message_star_count_)
  : group_call_id_(group_call_id_)
  , text_(std::move(text_))
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t sendGroupCallMessage::ID;

object_ptr<sendGroupCallMessage> sendGroupCallMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sendGroupCallMessage> res = make_object<sendGroupCallMessage>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return res;
}

void sendGroupCallMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SendGroupCallMessage");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

sendGroupCallMessage::ReturnType sendGroupCallMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void sendGroupCallMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SendGroupCallMessage").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass setAuthenticationPhoneNumber::Class;
jfieldID setAuthenticationPhoneNumber::phone_number_fieldID;
jfieldID setAuthenticationPhoneNumber::settings_fieldID;

setAuthenticationPhoneNumber::setAuthenticationPhoneNumber()
  : phone_number_()
  , settings_()
{}

setAuthenticationPhoneNumber::setAuthenticationPhoneNumber(string const &phone_number_, object_ptr<phoneNumberAuthenticationSettings> &&settings_)
  : phone_number_(phone_number_)
  , settings_(std::move(settings_))
{}

const std::int32_t setAuthenticationPhoneNumber::ID;

object_ptr<setAuthenticationPhoneNumber> setAuthenticationPhoneNumber::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setAuthenticationPhoneNumber> res = make_object<setAuthenticationPhoneNumber>();
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  res->settings_ = jni::fetch_tl_object<phoneNumberAuthenticationSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  return res;
}

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

setAuthenticationPhoneNumber::ReturnType setAuthenticationPhoneNumber::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatAvailableReactions::Class;
jfieldID setChatAvailableReactions::chat_id_fieldID;
jfieldID setChatAvailableReactions::available_reactions_fieldID;

setChatAvailableReactions::setChatAvailableReactions()
  : chat_id_()
  , available_reactions_()
{}

setChatAvailableReactions::setChatAvailableReactions(int53 chat_id_, object_ptr<ChatAvailableReactions> &&available_reactions_)
  : chat_id_(chat_id_)
  , available_reactions_(std::move(available_reactions_))
{}

const std::int32_t setChatAvailableReactions::ID;

object_ptr<setChatAvailableReactions> setChatAvailableReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatAvailableReactions> res = make_object<setChatAvailableReactions>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->available_reactions_ = jni::fetch_tl_object<ChatAvailableReactions>(env, jni::fetch_object(env, p, res->available_reactions_fieldID));
  return res;
}

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

setChatAvailableReactions::ReturnType setChatAvailableReactions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatAvailableReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatAvailableReactions").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    available_reactions_fieldID = jni::get_field_id(env, Class, "availableReactions", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatAvailableReactions;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setChatPaidMessageStarCount::Class;
jfieldID setChatPaidMessageStarCount::chat_id_fieldID;
jfieldID setChatPaidMessageStarCount::paid_message_star_count_fieldID;

setChatPaidMessageStarCount::setChatPaidMessageStarCount()
  : chat_id_()
  , paid_message_star_count_()
{}

setChatPaidMessageStarCount::setChatPaidMessageStarCount(int53 chat_id_, int53 paid_message_star_count_)
  : chat_id_(chat_id_)
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t setChatPaidMessageStarCount::ID;

object_ptr<setChatPaidMessageStarCount> setChatPaidMessageStarCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatPaidMessageStarCount> res = make_object<setChatPaidMessageStarCount>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return res;
}

void setChatPaidMessageStarCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetChatPaidMessageStarCount");
    s.store_field("chatId", chat_id_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

setChatPaidMessageStarCount::ReturnType setChatPaidMessageStarCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatPhoto::Class;
jfieldID setChatPhoto::chat_id_fieldID;
jfieldID setChatPhoto::photo_fieldID;

setChatPhoto::setChatPhoto()
  : chat_id_()
  , photo_()
{}

setChatPhoto::setChatPhoto(int53 chat_id_, object_ptr<InputChatPhoto> &&photo_)
  : chat_id_(chat_id_)
  , photo_(std::move(photo_))
{}

const std::int32_t setChatPhoto::ID;

object_ptr<setChatPhoto> setChatPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatPhoto> res = make_object<setChatPhoto>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->photo_ = jni::fetch_tl_object<InputChatPhoto>(env, jni::fetch_object(env, p, res->photo_fieldID));
  return res;
}

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

setChatPhoto::ReturnType setChatPhoto::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setChatPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetChatPhoto").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "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 setCustomEmojiStickerSetThumbnail::Class;
jfieldID setCustomEmojiStickerSetThumbnail::name_fieldID;
jfieldID setCustomEmojiStickerSetThumbnail::custom_emoji_id_fieldID;

setCustomEmojiStickerSetThumbnail::setCustomEmojiStickerSetThumbnail()
  : name_()
  , custom_emoji_id_()
{}

setCustomEmojiStickerSetThumbnail::setCustomEmojiStickerSetThumbnail(string const &name_, int64 custom_emoji_id_)
  : name_(name_)
  , custom_emoji_id_(custom_emoji_id_)
{}

const std::int32_t setCustomEmojiStickerSetThumbnail::ID;

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

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

setCustomEmojiStickerSetThumbnail::ReturnType setCustomEmojiStickerSetThumbnail::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setCustomLanguagePack::Class;
jfieldID setCustomLanguagePack::info_fieldID;
jfieldID setCustomLanguagePack::strings_fieldID;

setCustomLanguagePack::setCustomLanguagePack()
  : info_()
  , strings_()
{}

setCustomLanguagePack::setCustomLanguagePack(object_ptr<languagePackInfo> &&info_, array<object_ptr<languagePackString>> &&strings_)
  : info_(std::move(info_))
  , strings_(std::move(strings_))
{}

const std::int32_t setCustomLanguagePack::ID;

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

void setCustomLanguagePack::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetCustomLanguagePack");
    s.store_object_field("info", static_cast<const BaseObject *>(info_.get()));
    { 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();
  }
}

setCustomLanguagePack::ReturnType setCustomLanguagePack::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setCustomLanguagePack::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetCustomLanguagePack").c_str());
    info_fieldID = jni::get_field_id(env, Class, "info", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LanguagePackInfo;").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 setCustomLanguagePackString::Class;
jfieldID setCustomLanguagePackString::language_pack_id_fieldID;
jfieldID setCustomLanguagePackString::new_string_fieldID;

setCustomLanguagePackString::setCustomLanguagePackString()
  : language_pack_id_()
  , new_string_()
{}

setCustomLanguagePackString::setCustomLanguagePackString(string const &language_pack_id_, object_ptr<languagePackString> &&new_string_)
  : language_pack_id_(language_pack_id_)
  , new_string_(std::move(new_string_))
{}

const std::int32_t setCustomLanguagePackString::ID;

object_ptr<setCustomLanguagePackString> setCustomLanguagePackString::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setCustomLanguagePackString> res = make_object<setCustomLanguagePackString>();
  res->language_pack_id_ = jni::fetch_string(env, p, res->language_pack_id_fieldID);
  res->new_string_ = jni::fetch_tl_object<languagePackString>(env, jni::fetch_object(env, p, res->new_string_fieldID));
  return res;
}

void setCustomLanguagePackString::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetCustomLanguagePackString");
    s.store_field("languagePackId", language_pack_id_);
    s.store_object_field("newString", static_cast<const BaseObject *>(new_string_.get()));
    s.store_class_end();
  }
}

setCustomLanguagePackString::ReturnType setCustomLanguagePackString::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setCustomLanguagePackString::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetCustomLanguagePackString").c_str());
    language_pack_id_fieldID = jni::get_field_id(env, Class, "languagePackId", "Ljava/lang/String;");
    new_string_fieldID = jni::get_field_id(env, Class, "newString", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$LanguagePackString;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setGroupCallPaidMessageStarCount::Class;
jfieldID setGroupCallPaidMessageStarCount::group_call_id_fieldID;
jfieldID setGroupCallPaidMessageStarCount::paid_message_star_count_fieldID;

setGroupCallPaidMessageStarCount::setGroupCallPaidMessageStarCount()
  : group_call_id_()
  , paid_message_star_count_()
{}

setGroupCallPaidMessageStarCount::setGroupCallPaidMessageStarCount(int32 group_call_id_, int53 paid_message_star_count_)
  : group_call_id_(group_call_id_)
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t setGroupCallPaidMessageStarCount::ID;

object_ptr<setGroupCallPaidMessageStarCount> setGroupCallPaidMessageStarCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setGroupCallPaidMessageStarCount> res = make_object<setGroupCallPaidMessageStarCount>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return res;
}

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

setGroupCallPaidMessageStarCount::ReturnType setGroupCallPaidMessageStarCount::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setMainProfileTab::Class;
jfieldID setMainProfileTab::main_profile_tab_fieldID;

setMainProfileTab::setMainProfileTab()
  : main_profile_tab_()
{}

setMainProfileTab::setMainProfileTab(object_ptr<ProfileTab> &&main_profile_tab_)
  : main_profile_tab_(std::move(main_profile_tab_))
{}

const std::int32_t setMainProfileTab::ID;

object_ptr<setMainProfileTab> setMainProfileTab::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setMainProfileTab> res = make_object<setMainProfileTab>();
  res->main_profile_tab_ = jni::fetch_tl_object<ProfileTab>(env, jni::fetch_object(env, p, res->main_profile_tab_fieldID));
  return res;
}

void setMainProfileTab::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetMainProfileTab");
    s.store_object_field("mainProfileTab", static_cast<const BaseObject *>(main_profile_tab_.get()));
    s.store_class_end();
  }
}

setMainProfileTab::ReturnType setMainProfileTab::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setPaidMessageReactionType::Class;
jfieldID setPaidMessageReactionType::chat_id_fieldID;
jfieldID setPaidMessageReactionType::message_id_fieldID;
jfieldID setPaidMessageReactionType::type_fieldID;

setPaidMessageReactionType::setPaidMessageReactionType()
  : chat_id_()
  , message_id_()
  , type_()
{}

setPaidMessageReactionType::setPaidMessageReactionType(int53 chat_id_, int53 message_id_, object_ptr<PaidReactionType> &&type_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , type_(std::move(type_))
{}

const std::int32_t setPaidMessageReactionType::ID;

object_ptr<setPaidMessageReactionType> setPaidMessageReactionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPaidMessageReactionType> res = make_object<setPaidMessageReactionType>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->type_ = jni::fetch_tl_object<PaidReactionType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void setPaidMessageReactionType::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetPaidMessageReactionType");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

setPaidMessageReactionType::ReturnType setPaidMessageReactionType::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setPassword::Class;
jfieldID setPassword::old_password_fieldID;
jfieldID setPassword::new_password_fieldID;
jfieldID setPassword::new_hint_fieldID;
jfieldID setPassword::set_recovery_email_address_fieldID;
jfieldID setPassword::new_recovery_email_address_fieldID;

setPassword::setPassword()
  : old_password_()
  , new_password_()
  , new_hint_()
  , set_recovery_email_address_()
  , new_recovery_email_address_()
{}

setPassword::setPassword(string const &old_password_, string const &new_password_, string const &new_hint_, bool set_recovery_email_address_, string const &new_recovery_email_address_)
  : old_password_(old_password_)
  , new_password_(new_password_)
  , new_hint_(new_hint_)
  , set_recovery_email_address_(set_recovery_email_address_)
  , new_recovery_email_address_(new_recovery_email_address_)
{}

const std::int32_t setPassword::ID;

object_ptr<setPassword> setPassword::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPassword> res = make_object<setPassword>();
  res->old_password_ = jni::fetch_string(env, p, res->old_password_fieldID);
  res->new_password_ = jni::fetch_string(env, p, res->new_password_fieldID);
  res->new_hint_ = jni::fetch_string(env, p, res->new_hint_fieldID);
  res->set_recovery_email_address_ = (env->GetBooleanField(p, res->set_recovery_email_address_fieldID) != 0);
  res->new_recovery_email_address_ = jni::fetch_string(env, p, res->new_recovery_email_address_fieldID);
  return res;
}

void setPassword::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetPassword");
    s.store_field("oldPassword", old_password_);
    s.store_field("newPassword", new_password_);
    s.store_field("newHint", new_hint_);
    s.store_field("setRecoveryEmailAddress", set_recovery_email_address_);
    s.store_field("newRecoveryEmailAddress", new_recovery_email_address_);
    s.store_class_end();
  }
}

setPassword::ReturnType setPassword::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passwordState::fetch(env, p);
}

void setPassword::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetPassword").c_str());
    old_password_fieldID = jni::get_field_id(env, Class, "oldPassword", "Ljava/lang/String;");
    new_password_fieldID = jni::get_field_id(env, Class, "newPassword", "Ljava/lang/String;");
    new_hint_fieldID = jni::get_field_id(env, Class, "newHint", "Ljava/lang/String;");
    set_recovery_email_address_fieldID = jni::get_field_id(env, Class, "setRecoveryEmailAddress", "Z");
    new_recovery_email_address_fieldID = jni::get_field_id(env, Class, "newRecoveryEmailAddress", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setReadDatePrivacySettings::Class;
jfieldID setReadDatePrivacySettings::settings_fieldID;

setReadDatePrivacySettings::setReadDatePrivacySettings()
  : settings_()
{}

setReadDatePrivacySettings::setReadDatePrivacySettings(object_ptr<readDatePrivacySettings> &&settings_)
  : settings_(std::move(settings_))
{}

const std::int32_t setReadDatePrivacySettings::ID;

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

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

setReadDatePrivacySettings::ReturnType setReadDatePrivacySettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setScopeNotificationSettings::Class;
jfieldID setScopeNotificationSettings::scope_fieldID;
jfieldID setScopeNotificationSettings::notification_settings_fieldID;

setScopeNotificationSettings::setScopeNotificationSettings()
  : scope_()
  , notification_settings_()
{}

setScopeNotificationSettings::setScopeNotificationSettings(object_ptr<NotificationSettingsScope> &&scope_, object_ptr<scopeNotificationSettings> &&notification_settings_)
  : scope_(std::move(scope_))
  , notification_settings_(std::move(notification_settings_))
{}

const std::int32_t setScopeNotificationSettings::ID;

object_ptr<setScopeNotificationSettings> setScopeNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setScopeNotificationSettings> res = make_object<setScopeNotificationSettings>();
  res->scope_ = jni::fetch_tl_object<NotificationSettingsScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  res->notification_settings_ = jni::fetch_tl_object<scopeNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  return res;
}

void setScopeNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetScopeNotificationSettings");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_class_end();
  }
}

setScopeNotificationSettings::ReturnType setScopeNotificationSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setScopeNotificationSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetScopeNotificationSettings").c_str());
    scope_fieldID = jni::get_field_id(env, Class, "scope", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NotificationSettingsScope;").c_str());
    notification_settings_fieldID = jni::get_field_id(env, Class, "notificationSettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ScopeNotificationSettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setStickerEmojis::Class;
jfieldID setStickerEmojis::sticker_fieldID;
jfieldID setStickerEmojis::emojis_fieldID;

setStickerEmojis::setStickerEmojis()
  : sticker_()
  , emojis_()
{}

setStickerEmojis::setStickerEmojis(object_ptr<InputFile> &&sticker_, string const &emojis_)
  : sticker_(std::move(sticker_))
  , emojis_(emojis_)
{}

const std::int32_t setStickerEmojis::ID;

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

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

setStickerEmojis::ReturnType setStickerEmojis::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setUserNote::Class;
jfieldID setUserNote::user_id_fieldID;
jfieldID setUserNote::note_fieldID;

setUserNote::setUserNote()
  : user_id_()
  , note_()
{}

setUserNote::setUserNote(int53 user_id_, object_ptr<formattedText> &&note_)
  : user_id_(user_id_)
  , note_(std::move(note_))
{}

const std::int32_t setUserNote::ID;

object_ptr<setUserNote> setUserNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setUserNote> res = make_object<setUserNote>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->note_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->note_fieldID));
  return res;
}

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

setUserNote::ReturnType setUserNote::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setVideoChatDefaultParticipant::Class;
jfieldID setVideoChatDefaultParticipant::chat_id_fieldID;
jfieldID setVideoChatDefaultParticipant::default_participant_id_fieldID;

setVideoChatDefaultParticipant::setVideoChatDefaultParticipant()
  : chat_id_()
  , default_participant_id_()
{}

setVideoChatDefaultParticipant::setVideoChatDefaultParticipant(int53 chat_id_, object_ptr<MessageSender> &&default_participant_id_)
  : chat_id_(chat_id_)
  , default_participant_id_(std::move(default_participant_id_))
{}

const std::int32_t setVideoChatDefaultParticipant::ID;

object_ptr<setVideoChatDefaultParticipant> setVideoChatDefaultParticipant::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setVideoChatDefaultParticipant> res = make_object<setVideoChatDefaultParticipant>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->default_participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->default_participant_id_fieldID));
  return res;
}

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

setVideoChatDefaultParticipant::ReturnType setVideoChatDefaultParticipant::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setVideoChatDefaultParticipant::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetVideoChatDefaultParticipant").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    default_participant_id_fieldID = jni::get_field_id(env, Class, "defaultParticipantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass startLiveStory::Class;
jfieldID startLiveStory::chat_id_fieldID;
jfieldID startLiveStory::privacy_settings_fieldID;
jfieldID startLiveStory::protect_content_fieldID;
jfieldID startLiveStory::is_rtmp_stream_fieldID;
jfieldID startLiveStory::enable_messages_fieldID;
jfieldID startLiveStory::paid_message_star_count_fieldID;

startLiveStory::startLiveStory()
  : chat_id_()
  , privacy_settings_()
  , protect_content_()
  , is_rtmp_stream_()
  , enable_messages_()
  , paid_message_star_count_()
{}

startLiveStory::startLiveStory(int53 chat_id_, object_ptr<StoryPrivacySettings> &&privacy_settings_, bool protect_content_, bool is_rtmp_stream_, bool enable_messages_, int53 paid_message_star_count_)
  : chat_id_(chat_id_)
  , privacy_settings_(std::move(privacy_settings_))
  , protect_content_(protect_content_)
  , is_rtmp_stream_(is_rtmp_stream_)
  , enable_messages_(enable_messages_)
  , paid_message_star_count_(paid_message_star_count_)
{}

const std::int32_t startLiveStory::ID;

object_ptr<startLiveStory> startLiveStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<startLiveStory> res = make_object<startLiveStory>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->privacy_settings_ = jni::fetch_tl_object<StoryPrivacySettings>(env, jni::fetch_object(env, p, res->privacy_settings_fieldID));
  res->protect_content_ = (env->GetBooleanField(p, res->protect_content_fieldID) != 0);
  res->is_rtmp_stream_ = (env->GetBooleanField(p, res->is_rtmp_stream_fieldID) != 0);
  res->enable_messages_ = (env->GetBooleanField(p, res->enable_messages_fieldID) != 0);
  res->paid_message_star_count_ = env->GetLongField(p, res->paid_message_star_count_fieldID);
  return res;
}

void startLiveStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StartLiveStory");
    s.store_field("chatId", chat_id_);
    s.store_object_field("privacySettings", static_cast<const BaseObject *>(privacy_settings_.get()));
    s.store_field("protectContent", protect_content_);
    s.store_field("isRtmpStream", is_rtmp_stream_);
    s.store_field("enableMessages", enable_messages_);
    s.store_field("paidMessageStarCount", paid_message_star_count_);
    s.store_class_end();
  }
}

startLiveStory::ReturnType startLiveStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return StartLiveStoryResult::fetch(env, p);
}

void startLiveStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StartLiveStory").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    privacy_settings_fieldID = jni::get_field_id(env, Class, "privacySettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryPrivacySettings;").c_str());
    protect_content_fieldID = jni::get_field_id(env, Class, "protectContent", "Z");
    is_rtmp_stream_fieldID = jni::get_field_id(env, Class, "isRtmpStream", "Z");
    enable_messages_fieldID = jni::get_field_id(env, Class, "enableMessages", "Z");
    paid_message_star_count_fieldID = jni::get_field_id(env, Class, "paidMessageStarCount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass startScheduledVideoChat::Class;
jfieldID startScheduledVideoChat::group_call_id_fieldID;

startScheduledVideoChat::startScheduledVideoChat()
  : group_call_id_()
{}

startScheduledVideoChat::startScheduledVideoChat(int32 group_call_id_)
  : group_call_id_(group_call_id_)
{}

const std::int32_t startScheduledVideoChat::ID;

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

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

startScheduledVideoChat::ReturnType startScheduledVideoChat::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass testCallString::Class;
jfieldID testCallString::x_fieldID;

testCallString::testCallString()
  : x_()
{}

testCallString::testCallString(string const &x_)
  : x_(x_)
{}

const std::int32_t testCallString::ID;

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

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

testCallString::ReturnType testCallString::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return testString::fetch(env, p);
}

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

jclass testProxy::Class;
jfieldID testProxy::proxy_fieldID;
jfieldID testProxy::dc_id_fieldID;
jfieldID testProxy::timeout_fieldID;

testProxy::testProxy()
  : proxy_()
  , dc_id_()
  , timeout_()
{}

testProxy::testProxy(object_ptr<proxy> &&proxy_, int32 dc_id_, double timeout_)
  : proxy_(std::move(proxy_))
  , dc_id_(dc_id_)
  , timeout_(timeout_)
{}

const std::int32_t testProxy::ID;

object_ptr<testProxy> testProxy::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testProxy> res = make_object<testProxy>();
  res->proxy_ = jni::fetch_tl_object<proxy>(env, jni::fetch_object(env, p, res->proxy_fieldID));
  res->dc_id_ = env->GetIntField(p, res->dc_id_fieldID);
  res->timeout_ = env->GetDoubleField(p, res->timeout_fieldID);
  return res;
}

void testProxy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "TestProxy");
    s.store_object_field("proxy", static_cast<const BaseObject *>(proxy_.get()));
    s.store_field("dcId", dc_id_);
    s.store_field("timeout", timeout_);
    s.store_class_end();
  }
}

testProxy::ReturnType testProxy::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void testProxy::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$TestProxy").c_str());
    proxy_fieldID = jni::get_field_id(env, Class, "proxy", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Proxy;").c_str());
    dc_id_fieldID = jni::get_field_id(env, Class, "dcId", "I");
    timeout_fieldID = jni::get_field_id(env, Class, "timeout", "D");
    return true;
  }();
  (void)is_inited;
}

jclass toggleChatIsPinned::Class;
jfieldID toggleChatIsPinned::chat_list_fieldID;
jfieldID toggleChatIsPinned::chat_id_fieldID;
jfieldID toggleChatIsPinned::is_pinned_fieldID;

toggleChatIsPinned::toggleChatIsPinned()
  : chat_list_()
  , chat_id_()
  , is_pinned_()
{}

toggleChatIsPinned::toggleChatIsPinned(object_ptr<ChatList> &&chat_list_, int53 chat_id_, bool is_pinned_)
  : chat_list_(std::move(chat_list_))
  , chat_id_(chat_id_)
  , is_pinned_(is_pinned_)
{}

const std::int32_t toggleChatIsPinned::ID;

object_ptr<toggleChatIsPinned> toggleChatIsPinned::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleChatIsPinned> res = make_object<toggleChatIsPinned>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  return res;
}

void toggleChatIsPinned::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleChatIsPinned");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_field("chatId", chat_id_);
    s.store_field("isPinned", is_pinned_);
    s.store_class_end();
  }
}

toggleChatIsPinned::ReturnType toggleChatIsPinned::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleChatIsPinned::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleChatIsPinned").c_str());
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleGroupCallParticipantIsHandRaised::Class;
jfieldID toggleGroupCallParticipantIsHandRaised::group_call_id_fieldID;
jfieldID toggleGroupCallParticipantIsHandRaised::participant_id_fieldID;
jfieldID toggleGroupCallParticipantIsHandRaised::is_hand_raised_fieldID;

toggleGroupCallParticipantIsHandRaised::toggleGroupCallParticipantIsHandRaised()
  : group_call_id_()
  , participant_id_()
  , is_hand_raised_()
{}

toggleGroupCallParticipantIsHandRaised::toggleGroupCallParticipantIsHandRaised(int32 group_call_id_, object_ptr<MessageSender> &&participant_id_, bool is_hand_raised_)
  : group_call_id_(group_call_id_)
  , participant_id_(std::move(participant_id_))
  , is_hand_raised_(is_hand_raised_)
{}

const std::int32_t toggleGroupCallParticipantIsHandRaised::ID;

object_ptr<toggleGroupCallParticipantIsHandRaised> toggleGroupCallParticipantIsHandRaised::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGroupCallParticipantIsHandRaised> res = make_object<toggleGroupCallParticipantIsHandRaised>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->participant_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->participant_id_fieldID));
  res->is_hand_raised_ = (env->GetBooleanField(p, res->is_hand_raised_fieldID) != 0);
  return res;
}

void toggleGroupCallParticipantIsHandRaised::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleGroupCallParticipantIsHandRaised");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("participantId", static_cast<const BaseObject *>(participant_id_.get()));
    s.store_field("isHandRaised", is_hand_raised_);
    s.store_class_end();
  }
}

toggleGroupCallParticipantIsHandRaised::ReturnType toggleGroupCallParticipantIsHandRaised::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleGroupCallParticipantIsHandRaised::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleGroupCallParticipantIsHandRaised").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    participant_id_fieldID = jni::get_field_id(env, Class, "participantId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    is_hand_raised_fieldID = jni::get_field_id(env, Class, "isHandRaised", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleGroupCallScreenSharingIsPaused::Class;
jfieldID toggleGroupCallScreenSharingIsPaused::group_call_id_fieldID;
jfieldID toggleGroupCallScreenSharingIsPaused::is_paused_fieldID;

toggleGroupCallScreenSharingIsPaused::toggleGroupCallScreenSharingIsPaused()
  : group_call_id_()
  , is_paused_()
{}

toggleGroupCallScreenSharingIsPaused::toggleGroupCallScreenSharingIsPaused(int32 group_call_id_, bool is_paused_)
  : group_call_id_(group_call_id_)
  , is_paused_(is_paused_)
{}

const std::int32_t toggleGroupCallScreenSharingIsPaused::ID;

object_ptr<toggleGroupCallScreenSharingIsPaused> toggleGroupCallScreenSharingIsPaused::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleGroupCallScreenSharingIsPaused> res = make_object<toggleGroupCallScreenSharingIsPaused>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->is_paused_ = (env->GetBooleanField(p, res->is_paused_fieldID) != 0);
  return res;
}

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

toggleGroupCallScreenSharingIsPaused::ReturnType toggleGroupCallScreenSharingIsPaused::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSupergroupCanHaveSponsoredMessages::Class;
jfieldID toggleSupergroupCanHaveSponsoredMessages::supergroup_id_fieldID;
jfieldID toggleSupergroupCanHaveSponsoredMessages::can_have_sponsored_messages_fieldID;

toggleSupergroupCanHaveSponsoredMessages::toggleSupergroupCanHaveSponsoredMessages()
  : supergroup_id_()
  , can_have_sponsored_messages_()
{}

toggleSupergroupCanHaveSponsoredMessages::toggleSupergroupCanHaveSponsoredMessages(int53 supergroup_id_, bool can_have_sponsored_messages_)
  : supergroup_id_(supergroup_id_)
  , can_have_sponsored_messages_(can_have_sponsored_messages_)
{}

const std::int32_t toggleSupergroupCanHaveSponsoredMessages::ID;

object_ptr<toggleSupergroupCanHaveSponsoredMessages> toggleSupergroupCanHaveSponsoredMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupCanHaveSponsoredMessages> res = make_object<toggleSupergroupCanHaveSponsoredMessages>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->can_have_sponsored_messages_ = (env->GetBooleanField(p, res->can_have_sponsored_messages_fieldID) != 0);
  return res;
}

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

toggleSupergroupCanHaveSponsoredMessages::ReturnType toggleSupergroupCanHaveSponsoredMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass viewTrendingStickerSets::Class;
jfieldID viewTrendingStickerSets::sticker_set_ids_fieldID;

viewTrendingStickerSets::viewTrendingStickerSets()
  : sticker_set_ids_()
{}

viewTrendingStickerSets::viewTrendingStickerSets(array<int64> &&sticker_set_ids_)
  : sticker_set_ids_(std::move(sticker_set_ids_))
{}

const std::int32_t viewTrendingStickerSets::ID;

object_ptr<viewTrendingStickerSets> viewTrendingStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<viewTrendingStickerSets> res = make_object<viewTrendingStickerSets>();
  res->sticker_set_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->sticker_set_ids_fieldID));
  return res;
}

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

viewTrendingStickerSets::ReturnType viewTrendingStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void viewTrendingStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ViewTrendingStickerSets").c_str());
    sticker_set_ids_fieldID = jni::get_field_id(env, Class, "stickerSetIds", "[J");
    return true;
  }();
  (void)is_inited;
}
}  // namespace td_api
}  // namespace td
