#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 accountTtl::Class;
jfieldID accountTtl::days_fieldID;

accountTtl::accountTtl()
  : days_()
{}

accountTtl::accountTtl(int32 days_)
  : days_(days_)
{}

const std::int32_t accountTtl::ID;

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

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

void accountTtl::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AccountTtl");
    s.store_field("days", days_);
    s.store_class_end();
  }
}

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

jclass availableReactions::Class;
jfieldID availableReactions::top_reactions_fieldID;
jfieldID availableReactions::recent_reactions_fieldID;
jfieldID availableReactions::popular_reactions_fieldID;
jfieldID availableReactions::allow_custom_emoji_fieldID;
jfieldID availableReactions::are_tags_fieldID;
jfieldID availableReactions::unavailability_reason_fieldID;

availableReactions::availableReactions()
  : top_reactions_()
  , recent_reactions_()
  , popular_reactions_()
  , allow_custom_emoji_()
  , are_tags_()
  , unavailability_reason_()
{}

availableReactions::availableReactions(array<object_ptr<availableReaction>> &&top_reactions_, array<object_ptr<availableReaction>> &&recent_reactions_, array<object_ptr<availableReaction>> &&popular_reactions_, bool allow_custom_emoji_, bool are_tags_, object_ptr<ReactionUnavailabilityReason> &&unavailability_reason_)
  : top_reactions_(std::move(top_reactions_))
  , recent_reactions_(std::move(recent_reactions_))
  , popular_reactions_(std::move(popular_reactions_))
  , allow_custom_emoji_(allow_custom_emoji_)
  , are_tags_(are_tags_)
  , unavailability_reason_(std::move(unavailability_reason_))
{}

const std::int32_t availableReactions::ID;

object_ptr<availableReactions> availableReactions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<availableReactions> res = make_object<availableReactions>();
  res->top_reactions_ = jni::FetchVector<availableReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->top_reactions_fieldID));
  res->recent_reactions_ = jni::FetchVector<availableReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->recent_reactions_fieldID));
  res->popular_reactions_ = jni::FetchVector<availableReaction>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->popular_reactions_fieldID));
  res->allow_custom_emoji_ = (env->GetBooleanField(p, res->allow_custom_emoji_fieldID) != 0);
  res->are_tags_ = (env->GetBooleanField(p, res->are_tags_fieldID) != 0);
  res->unavailability_reason_ = jni::fetch_tl_object<ReactionUnavailabilityReason>(env, jni::fetch_object(env, p, res->unavailability_reason_fieldID));
  return res;
}

void availableReactions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, top_reactions_); if (arr_tmp_) { env->SetObjectField(s, top_reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, recent_reactions_); if (arr_tmp_) { env->SetObjectField(s, recent_reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { auto arr_tmp_ = jni::store_vector(env, popular_reactions_); if (arr_tmp_) { env->SetObjectField(s, popular_reactions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, allow_custom_emoji_fieldID, allow_custom_emoji_);
  env->SetBooleanField(s, are_tags_fieldID, are_tags_);
  if (unavailability_reason_ != nullptr) { jobject next; unavailability_reason_->store(env, next); if (next) { env->SetObjectField(s, unavailability_reason_fieldID, next); env->DeleteLocalRef(next); } }
}

void availableReactions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AvailableReactions");
    { s.store_vector_begin("topReactions", top_reactions_.size()); for (const auto &_value : top_reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("recentReactions", recent_reactions_.size()); for (const auto &_value : recent_reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    { s.store_vector_begin("popularReactions", popular_reactions_.size()); for (const auto &_value : popular_reactions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("allowCustomEmoji", allow_custom_emoji_);
    s.store_field("areTags", are_tags_);
    s.store_object_field("unavailabilityReason", static_cast<const BaseObject *>(unavailability_reason_.get()));
    s.store_class_end();
  }
}

void availableReactions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AvailableReactions").c_str());
    top_reactions_fieldID = jni::get_field_id(env, Class, "topReactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AvailableReaction;").c_str());
    recent_reactions_fieldID = jni::get_field_id(env, Class, "recentReactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AvailableReaction;").c_str());
    popular_reactions_fieldID = jni::get_field_id(env, Class, "popularReactions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$AvailableReaction;").c_str());
    allow_custom_emoji_fieldID = jni::get_field_id(env, Class, "allowCustomEmoji", "Z");
    are_tags_fieldID = jni::get_field_id(env, Class, "areTags", "Z");
    unavailability_reason_fieldID = jni::get_field_id(env, Class, "unavailabilityReason", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReactionUnavailabilityReason;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass BackgroundFill::Class;

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

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

jclass backgroundFillSolid::Class;
jfieldID backgroundFillSolid::color_fieldID;

backgroundFillSolid::backgroundFillSolid()
  : color_()
{}

backgroundFillSolid::backgroundFillSolid(int32 color_)
  : color_(color_)
{}

const std::int32_t backgroundFillSolid::ID;

object_ptr<BackgroundFill> backgroundFillSolid::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<backgroundFillSolid> res = make_object<backgroundFillSolid>();
  res->color_ = env->GetIntField(p, res->color_fieldID);
  return std::move(res);
}

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

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

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

jclass backgroundFillGradient::Class;
jfieldID backgroundFillGradient::top_color_fieldID;
jfieldID backgroundFillGradient::bottom_color_fieldID;
jfieldID backgroundFillGradient::rotation_angle_fieldID;

backgroundFillGradient::backgroundFillGradient()
  : top_color_()
  , bottom_color_()
  , rotation_angle_()
{}

backgroundFillGradient::backgroundFillGradient(int32 top_color_, int32 bottom_color_, int32 rotation_angle_)
  : top_color_(top_color_)
  , bottom_color_(bottom_color_)
  , rotation_angle_(rotation_angle_)
{}

const std::int32_t backgroundFillGradient::ID;

object_ptr<BackgroundFill> backgroundFillGradient::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<backgroundFillGradient> res = make_object<backgroundFillGradient>();
  res->top_color_ = env->GetIntField(p, res->top_color_fieldID);
  res->bottom_color_ = env->GetIntField(p, res->bottom_color_fieldID);
  res->rotation_angle_ = env->GetIntField(p, res->rotation_angle_fieldID);
  return std::move(res);
}

void backgroundFillGradient::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, top_color_fieldID, top_color_);
  env->SetIntField(s, bottom_color_fieldID, bottom_color_);
  env->SetIntField(s, rotation_angle_fieldID, rotation_angle_);
}

void backgroundFillGradient::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "BackgroundFillGradient");
    s.store_field("topColor", top_color_);
    s.store_field("bottomColor", bottom_color_);
    s.store_field("rotationAngle", rotation_angle_);
    s.store_class_end();
  }
}

void backgroundFillGradient::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BackgroundFillGradient").c_str());
    top_color_fieldID = jni::get_field_id(env, Class, "topColor", "I");
    bottom_color_fieldID = jni::get_field_id(env, Class, "bottomColor", "I");
    rotation_angle_fieldID = jni::get_field_id(env, Class, "rotationAngle", "I");
    return true;
  }();
  (void)is_inited;
}

jclass backgroundFillFreeformGradient::Class;
jfieldID backgroundFillFreeformGradient::colors_fieldID;

backgroundFillFreeformGradient::backgroundFillFreeformGradient()
  : colors_()
{}

backgroundFillFreeformGradient::backgroundFillFreeformGradient(array<int32> &&colors_)
  : colors_(std::move(colors_))
{}

const std::int32_t backgroundFillFreeformGradient::ID;

object_ptr<BackgroundFill> backgroundFillFreeformGradient::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<backgroundFillFreeformGradient> res = make_object<backgroundFillFreeformGradient>();
  res->colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->colors_fieldID));
  return std::move(res);
}

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

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

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

jclass bankCardInfo::Class;
jfieldID bankCardInfo::title_fieldID;
jfieldID bankCardInfo::actions_fieldID;

bankCardInfo::bankCardInfo()
  : title_()
  , actions_()
{}

bankCardInfo::bankCardInfo(string const &title_, array<object_ptr<bankCardActionOpenUrl>> &&actions_)
  : title_(title_)
  , actions_(std::move(actions_))
{}

const std::int32_t bankCardInfo::ID;

object_ptr<bankCardInfo> bankCardInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<bankCardInfo> res = make_object<bankCardInfo>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->actions_ = jni::FetchVector<bankCardActionOpenUrl>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->actions_fieldID));
  return res;
}

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

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

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

jclass botMediaPreview::Class;
jfieldID botMediaPreview::date_fieldID;
jfieldID botMediaPreview::content_fieldID;

botMediaPreview::botMediaPreview()
  : date_()
  , content_()
{}

botMediaPreview::botMediaPreview(int32 date_, object_ptr<StoryContent> &&content_)
  : date_(date_)
  , content_(std::move(content_))
{}

const std::int32_t botMediaPreview::ID;

object_ptr<botMediaPreview> botMediaPreview::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<botMediaPreview> res = make_object<botMediaPreview>();
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->content_ = jni::fetch_tl_object<StoryContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  return res;
}

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

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

void botMediaPreview::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$BotMediaPreview").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass botMediaPreviews::Class;
jfieldID botMediaPreviews::previews_fieldID;

botMediaPreviews::botMediaPreviews()
  : previews_()
{}

botMediaPreviews::botMediaPreviews(array<object_ptr<botMediaPreview>> &&previews_)
  : previews_(std::move(previews_))
{}

const std::int32_t botMediaPreviews::ID;

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

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

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

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

jclass businessChatLink::Class;
jfieldID businessChatLink::link_fieldID;
jfieldID businessChatLink::text_fieldID;
jfieldID businessChatLink::title_fieldID;
jfieldID businessChatLink::view_count_fieldID;

businessChatLink::businessChatLink()
  : link_()
  , text_()
  , title_()
  , view_count_()
{}

businessChatLink::businessChatLink(string const &link_, object_ptr<formattedText> &&text_, string const &title_, int32 view_count_)
  : link_(link_)
  , text_(std::move(text_))
  , title_(title_)
  , view_count_(view_count_)
{}

const std::int32_t businessChatLink::ID;

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

void businessChatLink::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, link_); if (nextString) { env->SetObjectField(s, link_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  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, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, view_count_fieldID, view_count_);
}

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

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

jclass businessLocation::Class;
jfieldID businessLocation::location_fieldID;
jfieldID businessLocation::address_fieldID;

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

businessLocation::businessLocation(object_ptr<location> &&location_, string const &address_)
  : location_(std::move(location_))
  , address_(address_)
{}

const std::int32_t businessLocation::ID;

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

void businessLocation::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (location_ != nullptr) { jobject next; location_->store(env, next); if (next) { env->SetObjectField(s, location_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, address_); if (nextString) { env->SetObjectField(s, address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

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

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

jclass ButtonStyle::Class;

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

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

jclass buttonStyleDefault::Class;

buttonStyleDefault::buttonStyleDefault() {
}

const std::int32_t buttonStyleDefault::ID;

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

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

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

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

jclass buttonStylePrimary::Class;

buttonStylePrimary::buttonStylePrimary() {
}

const std::int32_t buttonStylePrimary::ID;

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

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

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

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

jclass buttonStyleDanger::Class;

buttonStyleDanger::buttonStyleDanger() {
}

const std::int32_t buttonStyleDanger::ID;

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

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

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

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

jclass buttonStyleSuccess::Class;

buttonStyleSuccess::buttonStyleSuccess() {
}

const std::int32_t buttonStyleSuccess::ID;

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

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

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

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

jclass CanSendGiftResult::Class;

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

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

jclass canSendGiftResultOk::Class;

canSendGiftResultOk::canSendGiftResultOk() {
}

const std::int32_t canSendGiftResultOk::ID;

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

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

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

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

jclass canSendGiftResultFail::Class;
jfieldID canSendGiftResultFail::reason_fieldID;

canSendGiftResultFail::canSendGiftResultFail()
  : reason_()
{}

canSendGiftResultFail::canSendGiftResultFail(object_ptr<formattedText> &&reason_)
  : reason_(std::move(reason_))
{}

const std::int32_t canSendGiftResultFail::ID;

object_ptr<CanSendGiftResult> canSendGiftResultFail::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<canSendGiftResultFail> res = make_object<canSendGiftResultFail>();
  res->reason_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->reason_fieldID));
  return std::move(res);
}

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

void canSendGiftResultFail::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CanSendGiftResultFail");
    s.store_object_field("reason", static_cast<const BaseObject *>(reason_.get()));
    s.store_class_end();
  }
}

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

jclass chatBoostSlots::Class;
jfieldID chatBoostSlots::slots_fieldID;

chatBoostSlots::chatBoostSlots()
  : slots_()
{}

chatBoostSlots::chatBoostSlots(array<object_ptr<chatBoostSlot>> &&slots_)
  : slots_(std::move(slots_))
{}

const std::int32_t chatBoostSlots::ID;

object_ptr<chatBoostSlots> chatBoostSlots::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatBoostSlots> res = make_object<chatBoostSlots>();
  res->slots_ = jni::FetchVector<chatBoostSlot>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->slots_fieldID));
  return res;
}

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

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

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

jclass chatInviteLinkMember::Class;
jfieldID chatInviteLinkMember::user_id_fieldID;
jfieldID chatInviteLinkMember::joined_chat_date_fieldID;
jfieldID chatInviteLinkMember::via_chat_folder_invite_link_fieldID;
jfieldID chatInviteLinkMember::approver_user_id_fieldID;

chatInviteLinkMember::chatInviteLinkMember()
  : user_id_()
  , joined_chat_date_()
  , via_chat_folder_invite_link_()
  , approver_user_id_()
{}

chatInviteLinkMember::chatInviteLinkMember(int53 user_id_, int32 joined_chat_date_, bool via_chat_folder_invite_link_, int53 approver_user_id_)
  : user_id_(user_id_)
  , joined_chat_date_(joined_chat_date_)
  , via_chat_folder_invite_link_(via_chat_folder_invite_link_)
  , approver_user_id_(approver_user_id_)
{}

const std::int32_t chatInviteLinkMember::ID;

object_ptr<chatInviteLinkMember> chatInviteLinkMember::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatInviteLinkMember> res = make_object<chatInviteLinkMember>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->joined_chat_date_ = env->GetIntField(p, res->joined_chat_date_fieldID);
  res->via_chat_folder_invite_link_ = (env->GetBooleanField(p, res->via_chat_folder_invite_link_fieldID) != 0);
  res->approver_user_id_ = env->GetLongField(p, res->approver_user_id_fieldID);
  return res;
}

void chatInviteLinkMember::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, joined_chat_date_fieldID, joined_chat_date_);
  env->SetBooleanField(s, via_chat_folder_invite_link_fieldID, via_chat_folder_invite_link_);
  env->SetLongField(s, approver_user_id_fieldID, approver_user_id_);
}

void chatInviteLinkMember::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatInviteLinkMember");
    s.store_field("userId", user_id_);
    s.store_field("joinedChatDate", joined_chat_date_);
    s.store_field("viaChatFolderInviteLink", via_chat_folder_invite_link_);
    s.store_field("approverUserId", approver_user_id_);
    s.store_class_end();
  }
}

void chatInviteLinkMember::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatInviteLinkMember").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    joined_chat_date_fieldID = jni::get_field_id(env, Class, "joinedChatDate", "I");
    via_chat_folder_invite_link_fieldID = jni::get_field_id(env, Class, "viaChatFolderInviteLink", "Z");
    approver_user_id_fieldID = jni::get_field_id(env, Class, "approverUserId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass chatPermissions::Class;
jfieldID chatPermissions::can_send_basic_messages_fieldID;
jfieldID chatPermissions::can_send_audios_fieldID;
jfieldID chatPermissions::can_send_documents_fieldID;
jfieldID chatPermissions::can_send_photos_fieldID;
jfieldID chatPermissions::can_send_videos_fieldID;
jfieldID chatPermissions::can_send_video_notes_fieldID;
jfieldID chatPermissions::can_send_voice_notes_fieldID;
jfieldID chatPermissions::can_send_polls_fieldID;
jfieldID chatPermissions::can_send_other_messages_fieldID;
jfieldID chatPermissions::can_add_link_previews_fieldID;
jfieldID chatPermissions::can_react_to_messages_fieldID;
jfieldID chatPermissions::can_edit_tag_fieldID;
jfieldID chatPermissions::can_change_info_fieldID;
jfieldID chatPermissions::can_invite_users_fieldID;
jfieldID chatPermissions::can_pin_messages_fieldID;
jfieldID chatPermissions::can_create_topics_fieldID;

chatPermissions::chatPermissions()
  : can_send_basic_messages_()
  , can_send_audios_()
  , can_send_documents_()
  , can_send_photos_()
  , can_send_videos_()
  , can_send_video_notes_()
  , can_send_voice_notes_()
  , can_send_polls_()
  , can_send_other_messages_()
  , can_add_link_previews_()
  , can_react_to_messages_()
  , can_edit_tag_()
  , can_change_info_()
  , can_invite_users_()
  , can_pin_messages_()
  , can_create_topics_()
{}

chatPermissions::chatPermissions(bool can_send_basic_messages_, bool can_send_audios_, bool can_send_documents_, bool can_send_photos_, bool can_send_videos_, bool can_send_video_notes_, bool can_send_voice_notes_, bool can_send_polls_, bool can_send_other_messages_, bool can_add_link_previews_, bool can_react_to_messages_, bool can_edit_tag_, bool can_change_info_, bool can_invite_users_, bool can_pin_messages_, bool can_create_topics_)
  : can_send_basic_messages_(can_send_basic_messages_)
  , can_send_audios_(can_send_audios_)
  , can_send_documents_(can_send_documents_)
  , can_send_photos_(can_send_photos_)
  , can_send_videos_(can_send_videos_)
  , can_send_video_notes_(can_send_video_notes_)
  , can_send_voice_notes_(can_send_voice_notes_)
  , can_send_polls_(can_send_polls_)
  , can_send_other_messages_(can_send_other_messages_)
  , can_add_link_previews_(can_add_link_previews_)
  , can_react_to_messages_(can_react_to_messages_)
  , can_edit_tag_(can_edit_tag_)
  , can_change_info_(can_change_info_)
  , can_invite_users_(can_invite_users_)
  , can_pin_messages_(can_pin_messages_)
  , can_create_topics_(can_create_topics_)
{}

const std::int32_t chatPermissions::ID;

object_ptr<chatPermissions> chatPermissions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatPermissions> res = make_object<chatPermissions>();
  res->can_send_basic_messages_ = (env->GetBooleanField(p, res->can_send_basic_messages_fieldID) != 0);
  res->can_send_audios_ = (env->GetBooleanField(p, res->can_send_audios_fieldID) != 0);
  res->can_send_documents_ = (env->GetBooleanField(p, res->can_send_documents_fieldID) != 0);
  res->can_send_photos_ = (env->GetBooleanField(p, res->can_send_photos_fieldID) != 0);
  res->can_send_videos_ = (env->GetBooleanField(p, res->can_send_videos_fieldID) != 0);
  res->can_send_video_notes_ = (env->GetBooleanField(p, res->can_send_video_notes_fieldID) != 0);
  res->can_send_voice_notes_ = (env->GetBooleanField(p, res->can_send_voice_notes_fieldID) != 0);
  res->can_send_polls_ = (env->GetBooleanField(p, res->can_send_polls_fieldID) != 0);
  res->can_send_other_messages_ = (env->GetBooleanField(p, res->can_send_other_messages_fieldID) != 0);
  res->can_add_link_previews_ = (env->GetBooleanField(p, res->can_add_link_previews_fieldID) != 0);
  res->can_react_to_messages_ = (env->GetBooleanField(p, res->can_react_to_messages_fieldID) != 0);
  res->can_edit_tag_ = (env->GetBooleanField(p, res->can_edit_tag_fieldID) != 0);
  res->can_change_info_ = (env->GetBooleanField(p, res->can_change_info_fieldID) != 0);
  res->can_invite_users_ = (env->GetBooleanField(p, res->can_invite_users_fieldID) != 0);
  res->can_pin_messages_ = (env->GetBooleanField(p, res->can_pin_messages_fieldID) != 0);
  res->can_create_topics_ = (env->GetBooleanField(p, res->can_create_topics_fieldID) != 0);
  return res;
}

void chatPermissions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetBooleanField(s, can_send_basic_messages_fieldID, can_send_basic_messages_);
  env->SetBooleanField(s, can_send_audios_fieldID, can_send_audios_);
  env->SetBooleanField(s, can_send_documents_fieldID, can_send_documents_);
  env->SetBooleanField(s, can_send_photos_fieldID, can_send_photos_);
  env->SetBooleanField(s, can_send_videos_fieldID, can_send_videos_);
  env->SetBooleanField(s, can_send_video_notes_fieldID, can_send_video_notes_);
  env->SetBooleanField(s, can_send_voice_notes_fieldID, can_send_voice_notes_);
  env->SetBooleanField(s, can_send_polls_fieldID, can_send_polls_);
  env->SetBooleanField(s, can_send_other_messages_fieldID, can_send_other_messages_);
  env->SetBooleanField(s, can_add_link_previews_fieldID, can_add_link_previews_);
  env->SetBooleanField(s, can_react_to_messages_fieldID, can_react_to_messages_);
  env->SetBooleanField(s, can_edit_tag_fieldID, can_edit_tag_);
  env->SetBooleanField(s, can_change_info_fieldID, can_change_info_);
  env->SetBooleanField(s, can_invite_users_fieldID, can_invite_users_);
  env->SetBooleanField(s, can_pin_messages_fieldID, can_pin_messages_);
  env->SetBooleanField(s, can_create_topics_fieldID, can_create_topics_);
}

void chatPermissions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatPermissions");
    s.store_field("canSendBasicMessages", can_send_basic_messages_);
    s.store_field("canSendAudios", can_send_audios_);
    s.store_field("canSendDocuments", can_send_documents_);
    s.store_field("canSendPhotos", can_send_photos_);
    s.store_field("canSendVideos", can_send_videos_);
    s.store_field("canSendVideoNotes", can_send_video_notes_);
    s.store_field("canSendVoiceNotes", can_send_voice_notes_);
    s.store_field("canSendPolls", can_send_polls_);
    s.store_field("canSendOtherMessages", can_send_other_messages_);
    s.store_field("canAddLinkPreviews", can_add_link_previews_);
    s.store_field("canReactToMessages", can_react_to_messages_);
    s.store_field("canEditTag", can_edit_tag_);
    s.store_field("canChangeInfo", can_change_info_);
    s.store_field("canInviteUsers", can_invite_users_);
    s.store_field("canPinMessages", can_pin_messages_);
    s.store_field("canCreateTopics", can_create_topics_);
    s.store_class_end();
  }
}

void chatPermissions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatPermissions").c_str());
    can_send_basic_messages_fieldID = jni::get_field_id(env, Class, "canSendBasicMessages", "Z");
    can_send_audios_fieldID = jni::get_field_id(env, Class, "canSendAudios", "Z");
    can_send_documents_fieldID = jni::get_field_id(env, Class, "canSendDocuments", "Z");
    can_send_photos_fieldID = jni::get_field_id(env, Class, "canSendPhotos", "Z");
    can_send_videos_fieldID = jni::get_field_id(env, Class, "canSendVideos", "Z");
    can_send_video_notes_fieldID = jni::get_field_id(env, Class, "canSendVideoNotes", "Z");
    can_send_voice_notes_fieldID = jni::get_field_id(env, Class, "canSendVoiceNotes", "Z");
    can_send_polls_fieldID = jni::get_field_id(env, Class, "canSendPolls", "Z");
    can_send_other_messages_fieldID = jni::get_field_id(env, Class, "canSendOtherMessages", "Z");
    can_add_link_previews_fieldID = jni::get_field_id(env, Class, "canAddLinkPreviews", "Z");
    can_react_to_messages_fieldID = jni::get_field_id(env, Class, "canReactToMessages", "Z");
    can_edit_tag_fieldID = jni::get_field_id(env, Class, "canEditTag", "Z");
    can_change_info_fieldID = jni::get_field_id(env, Class, "canChangeInfo", "Z");
    can_invite_users_fieldID = jni::get_field_id(env, Class, "canInviteUsers", "Z");
    can_pin_messages_fieldID = jni::get_field_id(env, Class, "canPinMessages", "Z");
    can_create_topics_fieldID = jni::get_field_id(env, Class, "canCreateTopics", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass chatPhoto::Class;
jfieldID chatPhoto::id_fieldID;
jfieldID chatPhoto::added_date_fieldID;
jfieldID chatPhoto::minithumbnail_fieldID;
jfieldID chatPhoto::sizes_fieldID;
jfieldID chatPhoto::animation_fieldID;
jfieldID chatPhoto::small_animation_fieldID;
jfieldID chatPhoto::sticker_fieldID;

chatPhoto::chatPhoto()
  : id_()
  , added_date_()
  , minithumbnail_()
  , sizes_()
  , animation_()
  , small_animation_()
  , sticker_()
{}

chatPhoto::chatPhoto(int64 id_, int32 added_date_, object_ptr<minithumbnail> &&minithumbnail_, array<object_ptr<photoSize>> &&sizes_, object_ptr<animatedChatPhoto> &&animation_, object_ptr<animatedChatPhoto> &&small_animation_, object_ptr<chatPhotoSticker> &&sticker_)
  : id_(id_)
  , added_date_(added_date_)
  , minithumbnail_(std::move(minithumbnail_))
  , sizes_(std::move(sizes_))
  , animation_(std::move(animation_))
  , small_animation_(std::move(small_animation_))
  , sticker_(std::move(sticker_))
{}

const std::int32_t chatPhoto::ID;

object_ptr<chatPhoto> chatPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatPhoto> res = make_object<chatPhoto>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->added_date_ = env->GetIntField(p, res->added_date_fieldID);
  res->minithumbnail_ = jni::fetch_tl_object<minithumbnail>(env, jni::fetch_object(env, p, res->minithumbnail_fieldID));
  res->sizes_ = jni::FetchVector<photoSize>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->sizes_fieldID));
  res->animation_ = jni::fetch_tl_object<animatedChatPhoto>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->small_animation_ = jni::fetch_tl_object<animatedChatPhoto>(env, jni::fetch_object(env, p, res->small_animation_fieldID));
  res->sticker_ = jni::fetch_tl_object<chatPhotoSticker>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void chatPhoto::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetIntField(s, added_date_fieldID, added_date_);
  if (minithumbnail_ != nullptr) { jobject next; minithumbnail_->store(env, next); if (next) { env->SetObjectField(s, minithumbnail_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, sizes_); if (arr_tmp_) { env->SetObjectField(s, sizes_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (animation_ != nullptr) { jobject next; animation_->store(env, next); if (next) { env->SetObjectField(s, animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (small_animation_ != nullptr) { jobject next; small_animation_->store(env, next); if (next) { env->SetObjectField(s, small_animation_fieldID, next); env->DeleteLocalRef(next); } }
  if (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void chatPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ChatPhoto");
    s.store_field("id", id_);
    s.store_field("addedDate", added_date_);
    s.store_object_field("minithumbnail", static_cast<const BaseObject *>(minithumbnail_.get()));
    { s.store_vector_begin("sizes", sizes_.size()); for (const auto &_value : sizes_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_object_field("smallAnimation", static_cast<const BaseObject *>(small_animation_.get()));
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void chatPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatPhoto").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    added_date_fieldID = jni::get_field_id(env, Class, "addedDate", "I");
    minithumbnail_fieldID = jni::get_field_id(env, Class, "minithumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Minithumbnail;").c_str());
    sizes_fieldID = jni::get_field_id(env, Class, "sizes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PhotoSize;").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AnimatedChatPhoto;").c_str());
    small_animation_fieldID = jni::get_field_id(env, Class, "smallAnimation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AnimatedChatPhoto;").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhotoSticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chatPhotoSticker::Class;
jfieldID chatPhotoSticker::type_fieldID;
jfieldID chatPhotoSticker::background_fill_fieldID;

chatPhotoSticker::chatPhotoSticker()
  : type_()
  , background_fill_()
{}

chatPhotoSticker::chatPhotoSticker(object_ptr<ChatPhotoStickerType> &&type_, object_ptr<BackgroundFill> &&background_fill_)
  : type_(std::move(type_))
  , background_fill_(std::move(background_fill_))
{}

const std::int32_t chatPhotoSticker::ID;

object_ptr<chatPhotoSticker> chatPhotoSticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chatPhotoSticker> res = make_object<chatPhotoSticker>();
  res->type_ = jni::fetch_tl_object<ChatPhotoStickerType>(env, jni::fetch_object(env, p, res->type_fieldID));
  res->background_fill_ = jni::fetch_tl_object<BackgroundFill>(env, jni::fetch_object(env, p, res->background_fill_fieldID));
  return res;
}

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

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

void chatPhotoSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ChatPhotoSticker").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhotoStickerType;").c_str());
    background_fill_fieldID = jni::get_field_id(env, Class, "backgroundFill", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BackgroundFill;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass chats::Class;
jfieldID chats::total_count_fieldID;
jfieldID chats::chat_ids_fieldID;

chats::chats()
  : total_count_()
  , chat_ids_()
{}

chats::chats(int32 total_count_, array<int53> &&chat_ids_)
  : total_count_(total_count_)
  , chat_ids_(std::move(chat_ids_))
{}

const std::int32_t chats::ID;

object_ptr<chats> chats::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<chats> res = make_object<chats>();
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  res->chat_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->chat_ids_fieldID));
  return res;
}

void chats::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, chat_ids_); if (arr_tmp_) { env->SetObjectField(s, chat_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

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

jclass connectedAffiliatePrograms::Class;
jfieldID connectedAffiliatePrograms::total_count_fieldID;
jfieldID connectedAffiliatePrograms::programs_fieldID;
jfieldID connectedAffiliatePrograms::next_offset_fieldID;

connectedAffiliatePrograms::connectedAffiliatePrograms()
  : total_count_()
  , programs_()
  , next_offset_()
{}

connectedAffiliatePrograms::connectedAffiliatePrograms(int32 total_count_, array<object_ptr<connectedAffiliateProgram>> &&programs_, string const &next_offset_)
  : total_count_(total_count_)
  , programs_(std::move(programs_))
  , next_offset_(next_offset_)
{}

const std::int32_t connectedAffiliatePrograms::ID;

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

void connectedAffiliatePrograms::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, programs_); if (arr_tmp_) { env->SetObjectField(s, programs_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 connectedAffiliatePrograms::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ConnectedAffiliatePrograms");
    s.store_field("totalCount", total_count_);
    { s.store_vector_begin("programs", programs_.size()); for (const auto &_value : programs_) { 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 connectedAffiliatePrograms::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ConnectedAffiliatePrograms").c_str());
    total_count_fieldID = jni::get_field_id(env, Class, "totalCount", "I");
    programs_fieldID = jni::get_field_id(env, Class, "programs", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$ConnectedAffiliateProgram;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass contact::Class;
jfieldID contact::phone_number_fieldID;
jfieldID contact::first_name_fieldID;
jfieldID contact::last_name_fieldID;
jfieldID contact::vcard_fieldID;
jfieldID contact::user_id_fieldID;

contact::contact()
  : phone_number_()
  , first_name_()
  , last_name_()
  , vcard_()
  , user_id_()
{}

contact::contact(string const &phone_number_, string const &first_name_, string const &last_name_, string const &vcard_, int53 user_id_)
  : phone_number_(phone_number_)
  , first_name_(first_name_)
  , last_name_(last_name_)
  , vcard_(vcard_)
  , user_id_(user_id_)
{}

const std::int32_t contact::ID;

object_ptr<contact> contact::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<contact> res = make_object<contact>();
  res->phone_number_ = jni::fetch_string(env, p, res->phone_number_fieldID);
  res->first_name_ = jni::fetch_string(env, p, res->first_name_fieldID);
  res->last_name_ = jni::fetch_string(env, p, res->last_name_fieldID);
  res->vcard_ = jni::fetch_string(env, p, res->vcard_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  return res;
}

void contact::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, phone_number_); if (nextString) { env->SetObjectField(s, phone_number_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, first_name_); if (nextString) { env->SetObjectField(s, first_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, last_name_); if (nextString) { env->SetObjectField(s, last_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, vcard_); if (nextString) { env->SetObjectField(s, vcard_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, user_id_fieldID, user_id_);
}

void contact::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Contact");
    s.store_field("phoneNumber", phone_number_);
    s.store_field("firstName", first_name_);
    s.store_field("lastName", last_name_);
    s.store_field("vcard", vcard_);
    s.store_field("userId", user_id_);
    s.store_class_end();
  }
}

void contact::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Contact").c_str());
    phone_number_fieldID = jni::get_field_id(env, Class, "phoneNumber", "Ljava/lang/String;");
    first_name_fieldID = jni::get_field_id(env, Class, "firstName", "Ljava/lang/String;");
    last_name_fieldID = jni::get_field_id(env, Class, "lastName", "Ljava/lang/String;");
    vcard_fieldID = jni::get_field_id(env, Class, "vcard", "Ljava/lang/String;");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass createdBasicGroupChat::Class;
jfieldID createdBasicGroupChat::chat_id_fieldID;
jfieldID createdBasicGroupChat::failed_to_add_members_fieldID;

createdBasicGroupChat::createdBasicGroupChat()
  : chat_id_()
  , failed_to_add_members_()
{}

createdBasicGroupChat::createdBasicGroupChat(int53 chat_id_, object_ptr<failedToAddMembers> &&failed_to_add_members_)
  : chat_id_(chat_id_)
  , failed_to_add_members_(std::move(failed_to_add_members_))
{}

const std::int32_t createdBasicGroupChat::ID;

object_ptr<createdBasicGroupChat> createdBasicGroupChat::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createdBasicGroupChat> res = make_object<createdBasicGroupChat>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->failed_to_add_members_ = jni::fetch_tl_object<failedToAddMembers>(env, jni::fetch_object(env, p, res->failed_to_add_members_fieldID));
  return res;
}

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

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

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

jclass DiceStickers::Class;

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

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

jclass diceStickersRegular::Class;
jfieldID diceStickersRegular::sticker_fieldID;

diceStickersRegular::diceStickersRegular()
  : sticker_()
{}

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

const std::int32_t diceStickersRegular::ID;

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

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

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

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

jclass diceStickersSlotMachine::Class;
jfieldID diceStickersSlotMachine::background_fieldID;
jfieldID diceStickersSlotMachine::lever_fieldID;
jfieldID diceStickersSlotMachine::left_reel_fieldID;
jfieldID diceStickersSlotMachine::center_reel_fieldID;
jfieldID diceStickersSlotMachine::right_reel_fieldID;

diceStickersSlotMachine::diceStickersSlotMachine()
  : background_()
  , lever_()
  , left_reel_()
  , center_reel_()
  , right_reel_()
{}

diceStickersSlotMachine::diceStickersSlotMachine(object_ptr<sticker> &&background_, object_ptr<sticker> &&lever_, object_ptr<sticker> &&left_reel_, object_ptr<sticker> &&center_reel_, object_ptr<sticker> &&right_reel_)
  : background_(std::move(background_))
  , lever_(std::move(lever_))
  , left_reel_(std::move(left_reel_))
  , center_reel_(std::move(center_reel_))
  , right_reel_(std::move(right_reel_))
{}

const std::int32_t diceStickersSlotMachine::ID;

object_ptr<DiceStickers> diceStickersSlotMachine::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<diceStickersSlotMachine> res = make_object<diceStickersSlotMachine>();
  res->background_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->background_fieldID));
  res->lever_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->lever_fieldID));
  res->left_reel_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->left_reel_fieldID));
  res->center_reel_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->center_reel_fieldID));
  res->right_reel_ = jni::fetch_tl_object<sticker>(env, jni::fetch_object(env, p, res->right_reel_fieldID));
  return std::move(res);
}

void diceStickersSlotMachine::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (background_ != nullptr) { jobject next; background_->store(env, next); if (next) { env->SetObjectField(s, background_fieldID, next); env->DeleteLocalRef(next); } }
  if (lever_ != nullptr) { jobject next; lever_->store(env, next); if (next) { env->SetObjectField(s, lever_fieldID, next); env->DeleteLocalRef(next); } }
  if (left_reel_ != nullptr) { jobject next; left_reel_->store(env, next); if (next) { env->SetObjectField(s, left_reel_fieldID, next); env->DeleteLocalRef(next); } }
  if (center_reel_ != nullptr) { jobject next; center_reel_->store(env, next); if (next) { env->SetObjectField(s, center_reel_fieldID, next); env->DeleteLocalRef(next); } }
  if (right_reel_ != nullptr) { jobject next; right_reel_->store(env, next); if (next) { env->SetObjectField(s, right_reel_fieldID, next); env->DeleteLocalRef(next); } }
}

void diceStickersSlotMachine::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DiceStickersSlotMachine");
    s.store_object_field("background", static_cast<const BaseObject *>(background_.get()));
    s.store_object_field("lever", static_cast<const BaseObject *>(lever_.get()));
    s.store_object_field("leftReel", static_cast<const BaseObject *>(left_reel_.get()));
    s.store_object_field("centerReel", static_cast<const BaseObject *>(center_reel_.get()));
    s.store_object_field("rightReel", static_cast<const BaseObject *>(right_reel_.get()));
    s.store_class_end();
  }
}

void diceStickersSlotMachine::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DiceStickersSlotMachine").c_str());
    background_fieldID = jni::get_field_id(env, Class, "background", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    lever_fieldID = jni::get_field_id(env, Class, "lever", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    left_reel_fieldID = jni::get_field_id(env, Class, "leftReel", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    center_reel_fieldID = jni::get_field_id(env, Class, "centerReel", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    right_reel_fieldID = jni::get_field_id(env, Class, "rightReel", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Sticker;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass emojiStatusCustomEmojis::Class;
jfieldID emojiStatusCustomEmojis::custom_emoji_ids_fieldID;

emojiStatusCustomEmojis::emojiStatusCustomEmojis()
  : custom_emoji_ids_()
{}

emojiStatusCustomEmojis::emojiStatusCustomEmojis(array<int64> &&custom_emoji_ids_)
  : custom_emoji_ids_(std::move(custom_emoji_ids_))
{}

const std::int32_t emojiStatusCustomEmojis::ID;

object_ptr<emojiStatusCustomEmojis> emojiStatusCustomEmojis::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<emojiStatusCustomEmojis> res = make_object<emojiStatusCustomEmojis>();
  res->custom_emoji_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->custom_emoji_ids_fieldID));
  return res;
}

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

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

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

jclass FileType::Class;

object_ptr<FileType> FileType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case fileTypeNone::ID:
      return fileTypeNone::fetch(env, p);
    case fileTypeAnimation::ID:
      return fileTypeAnimation::fetch(env, p);
    case fileTypeAudio::ID:
      return fileTypeAudio::fetch(env, p);
    case fileTypeDocument::ID:
      return fileTypeDocument::fetch(env, p);
    case fileTypeLivePhotoVideo::ID:
      return fileTypeLivePhotoVideo::fetch(env, p);
    case fileTypeNotificationSound::ID:
      return fileTypeNotificationSound::fetch(env, p);
    case fileTypePhoto::ID:
      return fileTypePhoto::fetch(env, p);
    case fileTypePhotoStory::ID:
      return fileTypePhotoStory::fetch(env, p);
    case fileTypeProfilePhoto::ID:
      return fileTypeProfilePhoto::fetch(env, p);
    case fileTypeSecret::ID:
      return fileTypeSecret::fetch(env, p);
    case fileTypeSecretThumbnail::ID:
      return fileTypeSecretThumbnail::fetch(env, p);
    case fileTypeSecure::ID:
      return fileTypeSecure::fetch(env, p);
    case fileTypeSelfDestructingLivePhotoVideo::ID:
      return fileTypeSelfDestructingLivePhotoVideo::fetch(env, p);
    case fileTypeSelfDestructingPhoto::ID:
      return fileTypeSelfDestructingPhoto::fetch(env, p);
    case fileTypeSelfDestructingVideo::ID:
      return fileTypeSelfDestructingVideo::fetch(env, p);
    case fileTypeSelfDestructingVideoNote::ID:
      return fileTypeSelfDestructingVideoNote::fetch(env, p);
    case fileTypeSelfDestructingVoiceNote::ID:
      return fileTypeSelfDestructingVoiceNote::fetch(env, p);
    case fileTypeSticker::ID:
      return fileTypeSticker::fetch(env, p);
    case fileTypeThumbnail::ID:
      return fileTypeThumbnail::fetch(env, p);
    case fileTypeUnknown::ID:
      return fileTypeUnknown::fetch(env, p);
    case fileTypeVideo::ID:
      return fileTypeVideo::fetch(env, p);
    case fileTypeVideoNote::ID:
      return fileTypeVideoNote::fetch(env, p);
    case fileTypeVideoStory::ID:
      return fileTypeVideoStory::fetch(env, p);
    case fileTypeVoiceNote::ID:
      return fileTypeVoiceNote::fetch(env, p);
    case fileTypeWallpaper::ID:
      return fileTypeWallpaper::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass fileTypeNone::Class;

fileTypeNone::fileTypeNone() {
}

const std::int32_t fileTypeNone::ID;

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

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

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

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

jclass fileTypeAnimation::Class;

fileTypeAnimation::fileTypeAnimation() {
}

const std::int32_t fileTypeAnimation::ID;

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

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

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

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

jclass fileTypeAudio::Class;

fileTypeAudio::fileTypeAudio() {
}

const std::int32_t fileTypeAudio::ID;

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

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

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

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

jclass fileTypeDocument::Class;

fileTypeDocument::fileTypeDocument() {
}

const std::int32_t fileTypeDocument::ID;

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

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

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

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

jclass fileTypeLivePhotoVideo::Class;

fileTypeLivePhotoVideo::fileTypeLivePhotoVideo() {
}

const std::int32_t fileTypeLivePhotoVideo::ID;

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

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

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

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

jclass fileTypeNotificationSound::Class;

fileTypeNotificationSound::fileTypeNotificationSound() {
}

const std::int32_t fileTypeNotificationSound::ID;

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

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

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

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

jclass fileTypePhoto::Class;

fileTypePhoto::fileTypePhoto() {
}

const std::int32_t fileTypePhoto::ID;

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

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

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

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

jclass fileTypePhotoStory::Class;

fileTypePhotoStory::fileTypePhotoStory() {
}

const std::int32_t fileTypePhotoStory::ID;

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

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

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

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

jclass fileTypeProfilePhoto::Class;

fileTypeProfilePhoto::fileTypeProfilePhoto() {
}

const std::int32_t fileTypeProfilePhoto::ID;

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

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

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

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

jclass fileTypeSecret::Class;

fileTypeSecret::fileTypeSecret() {
}

const std::int32_t fileTypeSecret::ID;

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

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

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

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

jclass fileTypeSecretThumbnail::Class;

fileTypeSecretThumbnail::fileTypeSecretThumbnail() {
}

const std::int32_t fileTypeSecretThumbnail::ID;

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

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

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

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

jclass fileTypeSecure::Class;

fileTypeSecure::fileTypeSecure() {
}

const std::int32_t fileTypeSecure::ID;

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

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

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

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

jclass fileTypeSelfDestructingLivePhotoVideo::Class;

fileTypeSelfDestructingLivePhotoVideo::fileTypeSelfDestructingLivePhotoVideo() {
}

const std::int32_t fileTypeSelfDestructingLivePhotoVideo::ID;

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

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

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

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

jclass fileTypeSelfDestructingPhoto::Class;

fileTypeSelfDestructingPhoto::fileTypeSelfDestructingPhoto() {
}

const std::int32_t fileTypeSelfDestructingPhoto::ID;

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

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

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

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

jclass fileTypeSelfDestructingVideo::Class;

fileTypeSelfDestructingVideo::fileTypeSelfDestructingVideo() {
}

const std::int32_t fileTypeSelfDestructingVideo::ID;

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

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

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

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

jclass fileTypeSelfDestructingVideoNote::Class;

fileTypeSelfDestructingVideoNote::fileTypeSelfDestructingVideoNote() {
}

const std::int32_t fileTypeSelfDestructingVideoNote::ID;

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

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

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

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

jclass fileTypeSelfDestructingVoiceNote::Class;

fileTypeSelfDestructingVoiceNote::fileTypeSelfDestructingVoiceNote() {
}

const std::int32_t fileTypeSelfDestructingVoiceNote::ID;

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

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

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

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

jclass fileTypeSticker::Class;

fileTypeSticker::fileTypeSticker() {
}

const std::int32_t fileTypeSticker::ID;

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

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

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

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

jclass fileTypeThumbnail::Class;

fileTypeThumbnail::fileTypeThumbnail() {
}

const std::int32_t fileTypeThumbnail::ID;

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

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

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

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

jclass fileTypeUnknown::Class;

fileTypeUnknown::fileTypeUnknown() {
}

const std::int32_t fileTypeUnknown::ID;

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

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

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

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

jclass fileTypeVideo::Class;

fileTypeVideo::fileTypeVideo() {
}

const std::int32_t fileTypeVideo::ID;

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

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

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

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

jclass fileTypeVideoNote::Class;

fileTypeVideoNote::fileTypeVideoNote() {
}

const std::int32_t fileTypeVideoNote::ID;

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

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

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

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

jclass fileTypeVideoStory::Class;

fileTypeVideoStory::fileTypeVideoStory() {
}

const std::int32_t fileTypeVideoStory::ID;

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

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

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

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

jclass fileTypeVoiceNote::Class;

fileTypeVoiceNote::fileTypeVoiceNote() {
}

const std::int32_t fileTypeVoiceNote::ID;

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

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

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

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

jclass fileTypeWallpaper::Class;

fileTypeWallpaper::fileTypeWallpaper() {
}

const std::int32_t fileTypeWallpaper::ID;

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

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

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

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

jclass giftChatThemes::Class;
jfieldID giftChatThemes::themes_fieldID;
jfieldID giftChatThemes::next_offset_fieldID;

giftChatThemes::giftChatThemes()
  : themes_()
  , next_offset_()
{}

giftChatThemes::giftChatThemes(array<object_ptr<giftChatTheme>> &&themes_, string const &next_offset_)
  : themes_(std::move(themes_))
  , next_offset_(next_offset_)
{}

const std::int32_t giftChatThemes::ID;

object_ptr<giftChatThemes> giftChatThemes::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giftChatThemes> res = make_object<giftChatThemes>();
  res->themes_ = jni::FetchVector<giftChatTheme>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->themes_fieldID));
  res->next_offset_ = jni::fetch_string(env, p, res->next_offset_fieldID);
  return res;
}

void giftChatThemes::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, themes_); if (arr_tmp_) { env->SetObjectField(s, themes_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 giftChatThemes::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftChatThemes");
    { s.store_vector_begin("themes", themes_.size()); for (const auto &_value : themes_) { 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 giftChatThemes::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GiftChatThemes").c_str());
    themes_fieldID = jni::get_field_id(env, Class, "themes", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$GiftChatTheme;").c_str());
    next_offset_fieldID = jni::get_field_id(env, Class, "nextOffset", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass giftUpgradePrice::Class;
jfieldID giftUpgradePrice::date_fieldID;
jfieldID giftUpgradePrice::star_count_fieldID;

giftUpgradePrice::giftUpgradePrice()
  : date_()
  , star_count_()
{}

giftUpgradePrice::giftUpgradePrice(int32 date_, int53 star_count_)
  : date_(date_)
  , star_count_(star_count_)
{}

const std::int32_t giftUpgradePrice::ID;

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

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

void giftUpgradePrice::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiftUpgradePrice");
    s.store_field("date", date_);
    s.store_field("starCount", star_count_);
    s.store_class_end();
  }
}

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

jclass GiveawayPrize::Class;

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

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

jclass giveawayPrizePremium::Class;
jfieldID giveawayPrizePremium::month_count_fieldID;

giveawayPrizePremium::giveawayPrizePremium()
  : month_count_()
{}

giveawayPrizePremium::giveawayPrizePremium(int32 month_count_)
  : month_count_(month_count_)
{}

const std::int32_t giveawayPrizePremium::ID;

object_ptr<GiveawayPrize> giveawayPrizePremium::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giveawayPrizePremium> res = make_object<giveawayPrizePremium>();
  res->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  return std::move(res);
}

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

void giveawayPrizePremium::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GiveawayPrizePremium");
    s.store_field("monthCount", month_count_);
    s.store_class_end();
  }
}

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

jclass giveawayPrizeStars::Class;
jfieldID giveawayPrizeStars::star_count_fieldID;

giveawayPrizeStars::giveawayPrizeStars()
  : star_count_()
{}

giveawayPrizeStars::giveawayPrizeStars(int53 star_count_)
  : star_count_(star_count_)
{}

const std::int32_t giveawayPrizeStars::ID;

object_ptr<GiveawayPrize> giveawayPrizeStars::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<giveawayPrizeStars> res = make_object<giveawayPrizeStars>();
  res->star_count_ = env->GetLongField(p, res->star_count_fieldID);
  return std::move(res);
}

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

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

jclass groupCallJoinParameters::Class;
jfieldID groupCallJoinParameters::audio_source_id_fieldID;
jfieldID groupCallJoinParameters::payload_fieldID;
jfieldID groupCallJoinParameters::is_muted_fieldID;
jfieldID groupCallJoinParameters::is_my_video_enabled_fieldID;

groupCallJoinParameters::groupCallJoinParameters()
  : audio_source_id_()
  , payload_()
  , is_muted_()
  , is_my_video_enabled_()
{}

groupCallJoinParameters::groupCallJoinParameters(int32 audio_source_id_, string const &payload_, bool is_muted_, bool is_my_video_enabled_)
  : audio_source_id_(audio_source_id_)
  , payload_(payload_)
  , is_muted_(is_muted_)
  , is_my_video_enabled_(is_my_video_enabled_)
{}

const std::int32_t groupCallJoinParameters::ID;

object_ptr<groupCallJoinParameters> groupCallJoinParameters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallJoinParameters> res = make_object<groupCallJoinParameters>();
  res->audio_source_id_ = env->GetIntField(p, res->audio_source_id_fieldID);
  res->payload_ = jni::fetch_string(env, p, res->payload_fieldID);
  res->is_muted_ = (env->GetBooleanField(p, res->is_muted_fieldID) != 0);
  res->is_my_video_enabled_ = (env->GetBooleanField(p, res->is_my_video_enabled_fieldID) != 0);
  return res;
}

void groupCallJoinParameters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCallJoinParameters");
    s.store_field("audioSourceId", audio_source_id_);
    s.store_field("payload", payload_);
    s.store_field("isMuted", is_muted_);
    s.store_field("isMyVideoEnabled", is_my_video_enabled_);
    s.store_class_end();
  }
}

void groupCallJoinParameters::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCallJoinParameters").c_str());
    audio_source_id_fieldID = jni::get_field_id(env, Class, "audioSourceId", "I");
    payload_fieldID = jni::get_field_id(env, Class, "payload", "Ljava/lang/String;");
    is_muted_fieldID = jni::get_field_id(env, Class, "isMuted", "Z");
    is_my_video_enabled_fieldID = jni::get_field_id(env, Class, "isMyVideoEnabled", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass groupCallParticipantVideoInfo::Class;
jfieldID groupCallParticipantVideoInfo::source_groups_fieldID;
jfieldID groupCallParticipantVideoInfo::endpoint_id_fieldID;
jfieldID groupCallParticipantVideoInfo::is_paused_fieldID;

groupCallParticipantVideoInfo::groupCallParticipantVideoInfo()
  : source_groups_()
  , endpoint_id_()
  , is_paused_()
{}

groupCallParticipantVideoInfo::groupCallParticipantVideoInfo(array<object_ptr<groupCallVideoSourceGroup>> &&source_groups_, string const &endpoint_id_, bool is_paused_)
  : source_groups_(std::move(source_groups_))
  , endpoint_id_(endpoint_id_)
  , is_paused_(is_paused_)
{}

const std::int32_t groupCallParticipantVideoInfo::ID;

object_ptr<groupCallParticipantVideoInfo> groupCallParticipantVideoInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<groupCallParticipantVideoInfo> res = make_object<groupCallParticipantVideoInfo>();
  res->source_groups_ = jni::FetchVector<groupCallVideoSourceGroup>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->source_groups_fieldID));
  res->endpoint_id_ = jni::fetch_string(env, p, res->endpoint_id_fieldID);
  res->is_paused_ = (env->GetBooleanField(p, res->is_paused_fieldID) != 0);
  return res;
}

void groupCallParticipantVideoInfo::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, source_groups_); if (arr_tmp_) { env->SetObjectField(s, source_groups_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  { jstring nextString = jni::to_jstring(env, endpoint_id_); if (nextString) { env->SetObjectField(s, endpoint_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetBooleanField(s, is_paused_fieldID, is_paused_);
}

void groupCallParticipantVideoInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GroupCallParticipantVideoInfo");
    { s.store_vector_begin("sourceGroups", source_groups_.size()); for (const auto &_value : source_groups_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("endpointId", endpoint_id_);
    s.store_field("isPaused", is_paused_);
    s.store_class_end();
  }
}

void groupCallParticipantVideoInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GroupCallParticipantVideoInfo").c_str());
    source_groups_fieldID = jni::get_field_id(env, Class, "sourceGroups", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$GroupCallVideoSourceGroup;").c_str());
    endpoint_id_fieldID = jni::get_field_id(env, Class, "endpointId", "Ljava/lang/String;");
    is_paused_fieldID = jni::get_field_id(env, Class, "isPaused", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inlineMessageId::Class;
jfieldID inlineMessageId::id_fieldID;

inlineMessageId::inlineMessageId()
  : id_()
{}

inlineMessageId::inlineMessageId(string const &id_)
  : id_(id_)
{}

const std::int32_t inlineMessageId::ID;

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

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

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

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

jclass InputCall::Class;

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

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

jclass inputCallDiscarded::Class;
jfieldID inputCallDiscarded::call_id_fieldID;

inputCallDiscarded::inputCallDiscarded()
  : call_id_()
{}

inputCallDiscarded::inputCallDiscarded(int32 call_id_)
  : call_id_(call_id_)
{}

const std::int32_t inputCallDiscarded::ID;

object_ptr<InputCall> inputCallDiscarded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputCallDiscarded> res = make_object<inputCallDiscarded>();
  res->call_id_ = env->GetIntField(p, res->call_id_fieldID);
  return std::move(res);
}

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

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

jclass inputCallFromMessage::Class;
jfieldID inputCallFromMessage::chat_id_fieldID;
jfieldID inputCallFromMessage::message_id_fieldID;

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

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

const std::int32_t inputCallFromMessage::ID;

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

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

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

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

jclass inputPaidMediaTypePhoto::Class;
jfieldID inputPaidMediaTypePhoto::video_fieldID;

inputPaidMediaTypePhoto::inputPaidMediaTypePhoto()
  : video_()
{}

inputPaidMediaTypePhoto::inputPaidMediaTypePhoto(object_ptr<InputFile> &&video_)
  : video_(std::move(video_))
{}

const std::int32_t inputPaidMediaTypePhoto::ID;

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

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

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

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

jclass inputPaidMediaTypeVideo::Class;
jfieldID inputPaidMediaTypeVideo::cover_fieldID;
jfieldID inputPaidMediaTypeVideo::start_timestamp_fieldID;
jfieldID inputPaidMediaTypeVideo::duration_fieldID;
jfieldID inputPaidMediaTypeVideo::supports_streaming_fieldID;

inputPaidMediaTypeVideo::inputPaidMediaTypeVideo()
  : cover_()
  , start_timestamp_()
  , duration_()
  , supports_streaming_()
{}

inputPaidMediaTypeVideo::inputPaidMediaTypeVideo(object_ptr<InputFile> &&cover_, int32 start_timestamp_, int32 duration_, bool supports_streaming_)
  : cover_(std::move(cover_))
  , start_timestamp_(start_timestamp_)
  , duration_(duration_)
  , supports_streaming_(supports_streaming_)
{}

const std::int32_t inputPaidMediaTypeVideo::ID;

object_ptr<InputPaidMediaType> inputPaidMediaTypeVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPaidMediaTypeVideo> res = make_object<inputPaidMediaTypeVideo>();
  res->cover_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->cover_fieldID));
  res->start_timestamp_ = env->GetIntField(p, res->start_timestamp_fieldID);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->supports_streaming_ = (env->GetBooleanField(p, res->supports_streaming_fieldID) != 0);
  return std::move(res);
}

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

void inputPaidMediaTypeVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputPaidMediaTypeVideo");
    s.store_object_field("cover", static_cast<const BaseObject *>(cover_.get()));
    s.store_field("startTimestamp", start_timestamp_);
    s.store_field("duration", duration_);
    s.store_field("supportsStreaming", supports_streaming_);
    s.store_class_end();
  }
}

void inputPaidMediaTypeVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputPaidMediaTypeVideo").c_str());
    cover_fieldID = jni::get_field_id(env, Class, "cover", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    start_timestamp_fieldID = jni::get_field_id(env, Class, "startTimestamp", "I");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    supports_streaming_fieldID = jni::get_field_id(env, Class, "supportsStreaming", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputPollOption::Class;
jfieldID inputPollOption::text_fieldID;
jfieldID inputPollOption::media_fieldID;

inputPollOption::inputPollOption()
  : text_()
  , media_()
{}

inputPollOption::inputPollOption(object_ptr<formattedText> &&text_, object_ptr<InputMessageContent> &&media_)
  : text_(std::move(text_))
  , media_(std::move(media_))
{}

const std::int32_t inputPollOption::ID;

object_ptr<inputPollOption> inputPollOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputPollOption> res = make_object<inputPollOption>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->media_ = jni::fetch_tl_object<InputMessageContent>(env, jni::fetch_object(env, p, res->media_fieldID));
  return res;
}

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

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

void inputPollOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputPollOption").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputMessageContent;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass InputStoryContent::Class;

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

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

jclass inputStoryContentPhoto::Class;
jfieldID inputStoryContentPhoto::photo_fieldID;
jfieldID inputStoryContentPhoto::added_sticker_file_ids_fieldID;

inputStoryContentPhoto::inputStoryContentPhoto()
  : photo_()
  , added_sticker_file_ids_()
{}

inputStoryContentPhoto::inputStoryContentPhoto(object_ptr<InputFile> &&photo_, array<int32> &&added_sticker_file_ids_)
  : photo_(std::move(photo_))
  , added_sticker_file_ids_(std::move(added_sticker_file_ids_))
{}

const std::int32_t inputStoryContentPhoto::ID;

object_ptr<InputStoryContent> inputStoryContentPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryContentPhoto> res = make_object<inputStoryContentPhoto>();
  res->photo_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->added_sticker_file_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->added_sticker_file_ids_fieldID));
  return std::move(res);
}

void inputStoryContentPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryContentPhoto");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    { s.store_vector_begin("addedStickerFileIds", added_sticker_file_ids_.size()); for (const auto &_value : added_sticker_file_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

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

jclass inputStoryContentVideo::Class;
jfieldID inputStoryContentVideo::video_fieldID;
jfieldID inputStoryContentVideo::added_sticker_file_ids_fieldID;
jfieldID inputStoryContentVideo::duration_fieldID;
jfieldID inputStoryContentVideo::cover_frame_timestamp_fieldID;
jfieldID inputStoryContentVideo::is_animation_fieldID;

inputStoryContentVideo::inputStoryContentVideo()
  : video_()
  , added_sticker_file_ids_()
  , duration_()
  , cover_frame_timestamp_()
  , is_animation_()
{}

inputStoryContentVideo::inputStoryContentVideo(object_ptr<InputFile> &&video_, array<int32> &&added_sticker_file_ids_, double duration_, double cover_frame_timestamp_, bool is_animation_)
  : video_(std::move(video_))
  , added_sticker_file_ids_(std::move(added_sticker_file_ids_))
  , duration_(duration_)
  , cover_frame_timestamp_(cover_frame_timestamp_)
  , is_animation_(is_animation_)
{}

const std::int32_t inputStoryContentVideo::ID;

object_ptr<InputStoryContent> inputStoryContentVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputStoryContentVideo> res = make_object<inputStoryContentVideo>();
  res->video_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->added_sticker_file_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->added_sticker_file_ids_fieldID));
  res->duration_ = env->GetDoubleField(p, res->duration_fieldID);
  res->cover_frame_timestamp_ = env->GetDoubleField(p, res->cover_frame_timestamp_fieldID);
  res->is_animation_ = (env->GetBooleanField(p, res->is_animation_fieldID) != 0);
  return std::move(res);
}

void inputStoryContentVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputStoryContentVideo");
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    { s.store_vector_begin("addedStickerFileIds", added_sticker_file_ids_.size()); for (const auto &_value : added_sticker_file_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("duration", duration_);
    s.store_field("coverFrameTimestamp", cover_frame_timestamp_);
    s.store_field("isAnimation", is_animation_);
    s.store_class_end();
  }
}

void inputStoryContentVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputStoryContentVideo").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    added_sticker_file_ids_fieldID = jni::get_field_id(env, Class, "addedStickerFileIds", "[I");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "D");
    cover_frame_timestamp_fieldID = jni::get_field_id(env, Class, "coverFrameTimestamp", "D");
    is_animation_fieldID = jni::get_field_id(env, Class, "isAnimation", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inputThumbnail::Class;
jfieldID inputThumbnail::thumbnail_fieldID;
jfieldID inputThumbnail::width_fieldID;
jfieldID inputThumbnail::height_fieldID;

inputThumbnail::inputThumbnail()
  : thumbnail_()
  , width_()
  , height_()
{}

inputThumbnail::inputThumbnail(object_ptr<InputFile> &&thumbnail_, int32 width_, int32 height_)
  : thumbnail_(std::move(thumbnail_))
  , width_(width_)
  , height_(height_)
{}

const std::int32_t inputThumbnail::ID;

object_ptr<inputThumbnail> inputThumbnail::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inputThumbnail> res = make_object<inputThumbnail>();
  res->thumbnail_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  return res;
}

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

void inputThumbnail::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InputThumbnail");
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_class_end();
  }
}

void inputThumbnail::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InputThumbnail").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    return true;
  }();
  (void)is_inited;
}

jclass KeyboardButtonSource::Class;

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

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

jclass keyboardButtonSourceMessage::Class;
jfieldID keyboardButtonSourceMessage::chat_id_fieldID;
jfieldID keyboardButtonSourceMessage::message_id_fieldID;

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

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

const std::int32_t keyboardButtonSourceMessage::ID;

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

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

keyboardButtonSourceWebApp::keyboardButtonSourceWebApp()
  : bot_user_id_()
  , prepared_button_id_()
{}

keyboardButtonSourceWebApp::keyboardButtonSourceWebApp(int53 bot_user_id_, string const &prepared_button_id_)
  : bot_user_id_(bot_user_id_)
  , prepared_button_id_(prepared_button_id_)
{}

const std::int32_t keyboardButtonSourceWebApp::ID;

object_ptr<KeyboardButtonSource> keyboardButtonSourceWebApp::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<keyboardButtonSourceWebApp> res = make_object<keyboardButtonSourceWebApp>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->prepared_button_id_ = jni::fetch_string(env, p, res->prepared_button_id_fieldID);
  return std::move(res);
}

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

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

jclass maskPosition::Class;
jfieldID maskPosition::point_fieldID;
jfieldID maskPosition::x_shift_fieldID;
jfieldID maskPosition::y_shift_fieldID;
jfieldID maskPosition::scale_fieldID;

maskPosition::maskPosition()
  : point_()
  , x_shift_()
  , y_shift_()
  , scale_()
{}

maskPosition::maskPosition(object_ptr<MaskPoint> &&point_, double x_shift_, double y_shift_, double scale_)
  : point_(std::move(point_))
  , x_shift_(x_shift_)
  , y_shift_(y_shift_)
  , scale_(scale_)
{}

const std::int32_t maskPosition::ID;

object_ptr<maskPosition> maskPosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<maskPosition> res = make_object<maskPosition>();
  res->point_ = jni::fetch_tl_object<MaskPoint>(env, jni::fetch_object(env, p, res->point_fieldID));
  res->x_shift_ = env->GetDoubleField(p, res->x_shift_fieldID);
  res->y_shift_ = env->GetDoubleField(p, res->y_shift_fieldID);
  res->scale_ = env->GetDoubleField(p, res->scale_fieldID);
  return res;
}

void maskPosition::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (point_ != nullptr) { jobject next; point_->store(env, next); if (next) { env->SetObjectField(s, point_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetDoubleField(s, x_shift_fieldID, x_shift_);
  env->SetDoubleField(s, y_shift_fieldID, y_shift_);
  env->SetDoubleField(s, scale_fieldID, scale_);
}

void maskPosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MaskPosition");
    s.store_object_field("point", static_cast<const BaseObject *>(point_.get()));
    s.store_field("xShift", x_shift_);
    s.store_field("yShift", y_shift_);
    s.store_field("scale", scale_);
    s.store_class_end();
  }
}

void maskPosition::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$MaskPosition").c_str());
    point_fieldID = jni::get_field_id(env, Class, "point", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MaskPoint;").c_str());
    x_shift_fieldID = jni::get_field_id(env, Class, "xShift", "D");
    y_shift_fieldID = jni::get_field_id(env, Class, "yShift", "D");
    scale_fieldID = jni::get_field_id(env, Class, "scale", "D");
    return true;
  }();
  (void)is_inited;
}

jclass MessageFileType::Class;

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

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

jclass messageFileTypePrivate::Class;
jfieldID messageFileTypePrivate::name_fieldID;

messageFileTypePrivate::messageFileTypePrivate()
  : name_()
{}

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

const std::int32_t messageFileTypePrivate::ID;

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

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

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

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

jclass messageFileTypeGroup::Class;
jfieldID messageFileTypeGroup::title_fieldID;

messageFileTypeGroup::messageFileTypeGroup()
  : title_()
{}

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

const std::int32_t messageFileTypeGroup::ID;

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

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

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

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

jclass messageFileTypeUnknown::Class;

messageFileTypeUnknown::messageFileTypeUnknown() {
}

const std::int32_t messageFileTypeUnknown::ID;

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

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

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

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

jclass MessageReadDate::Class;

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

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

jclass messageReadDateRead::Class;
jfieldID messageReadDateRead::read_date_fieldID;

messageReadDateRead::messageReadDateRead()
  : read_date_()
{}

messageReadDateRead::messageReadDateRead(int32 read_date_)
  : read_date_(read_date_)
{}

const std::int32_t messageReadDateRead::ID;

object_ptr<MessageReadDate> messageReadDateRead::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<messageReadDateRead> res = make_object<messageReadDateRead>();
  res->read_date_ = env->GetIntField(p, res->read_date_fieldID);
  return std::move(res);
}

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

void messageReadDateRead::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "MessageReadDateRead");
    s.store_field("readDate", read_date_);
    s.store_class_end();
  }
}

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

jclass messageReadDateUnread::Class;

messageReadDateUnread::messageReadDateUnread() {
}

const std::int32_t messageReadDateUnread::ID;

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

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

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

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

jclass messageReadDateTooOld::Class;

messageReadDateTooOld::messageReadDateTooOld() {
}

const std::int32_t messageReadDateTooOld::ID;

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

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

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

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

jclass messageReadDateUserPrivacyRestricted::Class;

messageReadDateUserPrivacyRestricted::messageReadDateUserPrivacyRestricted() {
}

const std::int32_t messageReadDateUserPrivacyRestricted::ID;

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

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

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

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

jclass messageReadDateMyPrivacyRestricted::Class;

messageReadDateMyPrivacyRestricted::messageReadDateMyPrivacyRestricted() {
}

const std::int32_t messageReadDateMyPrivacyRestricted::ID;

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

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

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

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

jclass minithumbnail::Class;
jfieldID minithumbnail::width_fieldID;
jfieldID minithumbnail::height_fieldID;
jfieldID minithumbnail::data_fieldID;

minithumbnail::minithumbnail()
  : width_()
  , height_()
  , data_()
{}

minithumbnail::minithumbnail(int32 width_, int32 height_, bytes const &data_)
  : width_(width_)
  , height_(height_)
  , data_(std::move(data_))
{}

const std::int32_t minithumbnail::ID;

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

void minithumbnail::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_);
  { jbyteArray nextBytes = jni::to_bytes(env, data_); if (nextBytes) { env->SetObjectField(s, data_fieldID, nextBytes); env->DeleteLocalRef(nextBytes); } }
}

void minithumbnail::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Minithumbnail");
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_bytes_field("data", data_);
    s.store_class_end();
  }
}

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

jclass PageBlock::Class;

object_ptr<PageBlock> PageBlock::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case pageBlockTitle::ID:
      return pageBlockTitle::fetch(env, p);
    case pageBlockSubtitle::ID:
      return pageBlockSubtitle::fetch(env, p);
    case pageBlockAuthorDate::ID:
      return pageBlockAuthorDate::fetch(env, p);
    case pageBlockHeader::ID:
      return pageBlockHeader::fetch(env, p);
    case pageBlockSubheader::ID:
      return pageBlockSubheader::fetch(env, p);
    case pageBlockKicker::ID:
      return pageBlockKicker::fetch(env, p);
    case pageBlockParagraph::ID:
      return pageBlockParagraph::fetch(env, p);
    case pageBlockPreformatted::ID:
      return pageBlockPreformatted::fetch(env, p);
    case pageBlockFooter::ID:
      return pageBlockFooter::fetch(env, p);
    case pageBlockDivider::ID:
      return pageBlockDivider::fetch(env, p);
    case pageBlockAnchor::ID:
      return pageBlockAnchor::fetch(env, p);
    case pageBlockList::ID:
      return pageBlockList::fetch(env, p);
    case pageBlockBlockQuote::ID:
      return pageBlockBlockQuote::fetch(env, p);
    case pageBlockPullQuote::ID:
      return pageBlockPullQuote::fetch(env, p);
    case pageBlockAnimation::ID:
      return pageBlockAnimation::fetch(env, p);
    case pageBlockAudio::ID:
      return pageBlockAudio::fetch(env, p);
    case pageBlockPhoto::ID:
      return pageBlockPhoto::fetch(env, p);
    case pageBlockVideo::ID:
      return pageBlockVideo::fetch(env, p);
    case pageBlockVoiceNote::ID:
      return pageBlockVoiceNote::fetch(env, p);
    case pageBlockCover::ID:
      return pageBlockCover::fetch(env, p);
    case pageBlockEmbedded::ID:
      return pageBlockEmbedded::fetch(env, p);
    case pageBlockEmbeddedPost::ID:
      return pageBlockEmbeddedPost::fetch(env, p);
    case pageBlockCollage::ID:
      return pageBlockCollage::fetch(env, p);
    case pageBlockSlideshow::ID:
      return pageBlockSlideshow::fetch(env, p);
    case pageBlockChatLink::ID:
      return pageBlockChatLink::fetch(env, p);
    case pageBlockTable::ID:
      return pageBlockTable::fetch(env, p);
    case pageBlockDetails::ID:
      return pageBlockDetails::fetch(env, p);
    case pageBlockRelatedArticles::ID:
      return pageBlockRelatedArticles::fetch(env, p);
    case pageBlockMap::ID:
      return pageBlockMap::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass pageBlockTitle::Class;
jfieldID pageBlockTitle::title_fieldID;

pageBlockTitle::pageBlockTitle()
  : title_()
{}

pageBlockTitle::pageBlockTitle(object_ptr<RichText> &&title_)
  : title_(std::move(title_))
{}

const std::int32_t pageBlockTitle::ID;

object_ptr<PageBlock> pageBlockTitle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockTitle> res = make_object<pageBlockTitle>();
  res->title_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->title_fieldID));
  return std::move(res);
}

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

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

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

jclass pageBlockSubtitle::Class;
jfieldID pageBlockSubtitle::subtitle_fieldID;

pageBlockSubtitle::pageBlockSubtitle()
  : subtitle_()
{}

pageBlockSubtitle::pageBlockSubtitle(object_ptr<RichText> &&subtitle_)
  : subtitle_(std::move(subtitle_))
{}

const std::int32_t pageBlockSubtitle::ID;

object_ptr<PageBlock> pageBlockSubtitle::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockSubtitle> res = make_object<pageBlockSubtitle>();
  res->subtitle_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->subtitle_fieldID));
  return std::move(res);
}

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

void pageBlockSubtitle::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockSubtitle");
    s.store_object_field("subtitle", static_cast<const BaseObject *>(subtitle_.get()));
    s.store_class_end();
  }
}

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

jclass pageBlockAuthorDate::Class;
jfieldID pageBlockAuthorDate::author_fieldID;
jfieldID pageBlockAuthorDate::publish_date_fieldID;

pageBlockAuthorDate::pageBlockAuthorDate()
  : author_()
  , publish_date_()
{}

pageBlockAuthorDate::pageBlockAuthorDate(object_ptr<RichText> &&author_, int32 publish_date_)
  : author_(std::move(author_))
  , publish_date_(publish_date_)
{}

const std::int32_t pageBlockAuthorDate::ID;

object_ptr<PageBlock> pageBlockAuthorDate::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockAuthorDate> res = make_object<pageBlockAuthorDate>();
  res->author_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->author_fieldID));
  res->publish_date_ = env->GetIntField(p, res->publish_date_fieldID);
  return std::move(res);
}

void pageBlockAuthorDate::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (author_ != nullptr) { jobject next; author_->store(env, next); if (next) { env->SetObjectField(s, author_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, publish_date_fieldID, publish_date_);
}

void pageBlockAuthorDate::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockAuthorDate");
    s.store_object_field("author", static_cast<const BaseObject *>(author_.get()));
    s.store_field("publishDate", publish_date_);
    s.store_class_end();
  }
}

void pageBlockAuthorDate::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockAuthorDate").c_str());
    author_fieldID = jni::get_field_id(env, Class, "author", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    publish_date_fieldID = jni::get_field_id(env, Class, "publishDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockHeader::Class;
jfieldID pageBlockHeader::header_fieldID;

pageBlockHeader::pageBlockHeader()
  : header_()
{}

pageBlockHeader::pageBlockHeader(object_ptr<RichText> &&header_)
  : header_(std::move(header_))
{}

const std::int32_t pageBlockHeader::ID;

object_ptr<PageBlock> pageBlockHeader::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockHeader> res = make_object<pageBlockHeader>();
  res->header_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->header_fieldID));
  return std::move(res);
}

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

void pageBlockHeader::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockHeader");
    s.store_object_field("header", static_cast<const BaseObject *>(header_.get()));
    s.store_class_end();
  }
}

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

jclass pageBlockSubheader::Class;
jfieldID pageBlockSubheader::subheader_fieldID;

pageBlockSubheader::pageBlockSubheader()
  : subheader_()
{}

pageBlockSubheader::pageBlockSubheader(object_ptr<RichText> &&subheader_)
  : subheader_(std::move(subheader_))
{}

const std::int32_t pageBlockSubheader::ID;

object_ptr<PageBlock> pageBlockSubheader::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockSubheader> res = make_object<pageBlockSubheader>();
  res->subheader_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->subheader_fieldID));
  return std::move(res);
}

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

void pageBlockSubheader::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockSubheader");
    s.store_object_field("subheader", static_cast<const BaseObject *>(subheader_.get()));
    s.store_class_end();
  }
}

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

jclass pageBlockKicker::Class;
jfieldID pageBlockKicker::kicker_fieldID;

pageBlockKicker::pageBlockKicker()
  : kicker_()
{}

pageBlockKicker::pageBlockKicker(object_ptr<RichText> &&kicker_)
  : kicker_(std::move(kicker_))
{}

const std::int32_t pageBlockKicker::ID;

object_ptr<PageBlock> pageBlockKicker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockKicker> res = make_object<pageBlockKicker>();
  res->kicker_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->kicker_fieldID));
  return std::move(res);
}

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

void pageBlockKicker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockKicker");
    s.store_object_field("kicker", static_cast<const BaseObject *>(kicker_.get()));
    s.store_class_end();
  }
}

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

jclass pageBlockParagraph::Class;
jfieldID pageBlockParagraph::text_fieldID;

pageBlockParagraph::pageBlockParagraph()
  : text_()
{}

pageBlockParagraph::pageBlockParagraph(object_ptr<RichText> &&text_)
  : text_(std::move(text_))
{}

const std::int32_t pageBlockParagraph::ID;

object_ptr<PageBlock> pageBlockParagraph::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockParagraph> res = make_object<pageBlockParagraph>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  return std::move(res);
}

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

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

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

jclass pageBlockPreformatted::Class;
jfieldID pageBlockPreformatted::text_fieldID;
jfieldID pageBlockPreformatted::language_fieldID;

pageBlockPreformatted::pageBlockPreformatted()
  : text_()
  , language_()
{}

pageBlockPreformatted::pageBlockPreformatted(object_ptr<RichText> &&text_, string const &language_)
  : text_(std::move(text_))
  , language_(language_)
{}

const std::int32_t pageBlockPreformatted::ID;

object_ptr<PageBlock> pageBlockPreformatted::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockPreformatted> res = make_object<pageBlockPreformatted>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->language_ = jni::fetch_string(env, p, res->language_fieldID);
  return std::move(res);
}

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

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

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

jclass pageBlockFooter::Class;
jfieldID pageBlockFooter::footer_fieldID;

pageBlockFooter::pageBlockFooter()
  : footer_()
{}

pageBlockFooter::pageBlockFooter(object_ptr<RichText> &&footer_)
  : footer_(std::move(footer_))
{}

const std::int32_t pageBlockFooter::ID;

object_ptr<PageBlock> pageBlockFooter::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockFooter> res = make_object<pageBlockFooter>();
  res->footer_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->footer_fieldID));
  return std::move(res);
}

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

void pageBlockFooter::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockFooter");
    s.store_object_field("footer", static_cast<const BaseObject *>(footer_.get()));
    s.store_class_end();
  }
}

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

jclass pageBlockDivider::Class;

pageBlockDivider::pageBlockDivider() {
}

const std::int32_t pageBlockDivider::ID;

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

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

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

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

jclass pageBlockAnchor::Class;
jfieldID pageBlockAnchor::name_fieldID;

pageBlockAnchor::pageBlockAnchor()
  : name_()
{}

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

const std::int32_t pageBlockAnchor::ID;

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

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

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

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

jclass pageBlockList::Class;
jfieldID pageBlockList::items_fieldID;

pageBlockList::pageBlockList()
  : items_()
{}

pageBlockList::pageBlockList(array<object_ptr<pageBlockListItem>> &&items_)
  : items_(std::move(items_))
{}

const std::int32_t pageBlockList::ID;

object_ptr<PageBlock> pageBlockList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockList> res = make_object<pageBlockList>();
  res->items_ = jni::FetchVector<pageBlockListItem>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->items_fieldID));
  return std::move(res);
}

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

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

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

jclass pageBlockBlockQuote::Class;
jfieldID pageBlockBlockQuote::text_fieldID;
jfieldID pageBlockBlockQuote::credit_fieldID;

pageBlockBlockQuote::pageBlockBlockQuote()
  : text_()
  , credit_()
{}

pageBlockBlockQuote::pageBlockBlockQuote(object_ptr<RichText> &&text_, object_ptr<RichText> &&credit_)
  : text_(std::move(text_))
  , credit_(std::move(credit_))
{}

const std::int32_t pageBlockBlockQuote::ID;

object_ptr<PageBlock> pageBlockBlockQuote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockBlockQuote> res = make_object<pageBlockBlockQuote>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->credit_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->credit_fieldID));
  return std::move(res);
}

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

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

void pageBlockBlockQuote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockBlockQuote").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    credit_fieldID = jni::get_field_id(env, Class, "credit", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockPullQuote::Class;
jfieldID pageBlockPullQuote::text_fieldID;
jfieldID pageBlockPullQuote::credit_fieldID;

pageBlockPullQuote::pageBlockPullQuote()
  : text_()
  , credit_()
{}

pageBlockPullQuote::pageBlockPullQuote(object_ptr<RichText> &&text_, object_ptr<RichText> &&credit_)
  : text_(std::move(text_))
  , credit_(std::move(credit_))
{}

const std::int32_t pageBlockPullQuote::ID;

object_ptr<PageBlock> pageBlockPullQuote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockPullQuote> res = make_object<pageBlockPullQuote>();
  res->text_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->credit_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->credit_fieldID));
  return std::move(res);
}

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

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

void pageBlockPullQuote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockPullQuote").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    credit_fieldID = jni::get_field_id(env, Class, "credit", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockAnimation::Class;
jfieldID pageBlockAnimation::animation_fieldID;
jfieldID pageBlockAnimation::caption_fieldID;
jfieldID pageBlockAnimation::need_autoplay_fieldID;

pageBlockAnimation::pageBlockAnimation()
  : animation_()
  , caption_()
  , need_autoplay_()
{}

pageBlockAnimation::pageBlockAnimation(object_ptr<animation> &&animation_, object_ptr<pageBlockCaption> &&caption_, bool need_autoplay_)
  : animation_(std::move(animation_))
  , caption_(std::move(caption_))
  , need_autoplay_(need_autoplay_)
{}

const std::int32_t pageBlockAnimation::ID;

object_ptr<PageBlock> pageBlockAnimation::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockAnimation> res = make_object<pageBlockAnimation>();
  res->animation_ = jni::fetch_tl_object<animation>(env, jni::fetch_object(env, p, res->animation_fieldID));
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->need_autoplay_ = (env->GetBooleanField(p, res->need_autoplay_fieldID) != 0);
  return std::move(res);
}

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

void pageBlockAnimation::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockAnimation");
    s.store_object_field("animation", static_cast<const BaseObject *>(animation_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("needAutoplay", need_autoplay_);
    s.store_class_end();
  }
}

void pageBlockAnimation::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockAnimation").c_str());
    animation_fieldID = jni::get_field_id(env, Class, "animation", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Animation;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    need_autoplay_fieldID = jni::get_field_id(env, Class, "needAutoplay", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockAudio::Class;
jfieldID pageBlockAudio::audio_fieldID;
jfieldID pageBlockAudio::caption_fieldID;

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

pageBlockAudio::pageBlockAudio(object_ptr<audio> &&audio_, object_ptr<pageBlockCaption> &&caption_)
  : audio_(std::move(audio_))
  , caption_(std::move(caption_))
{}

const std::int32_t pageBlockAudio::ID;

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

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

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

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

jclass pageBlockPhoto::Class;
jfieldID pageBlockPhoto::photo_fieldID;
jfieldID pageBlockPhoto::caption_fieldID;
jfieldID pageBlockPhoto::url_fieldID;

pageBlockPhoto::pageBlockPhoto()
  : photo_()
  , caption_()
  , url_()
{}

pageBlockPhoto::pageBlockPhoto(object_ptr<photo> &&photo_, object_ptr<pageBlockCaption> &&caption_, string const &url_)
  : photo_(std::move(photo_))
  , caption_(std::move(caption_))
  , url_(url_)
{}

const std::int32_t pageBlockPhoto::ID;

object_ptr<PageBlock> pageBlockPhoto::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockPhoto> res = make_object<pageBlockPhoto>();
  res->photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  return std::move(res);
}

void pageBlockPhoto::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 (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void pageBlockPhoto::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockPhoto");
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("url", url_);
    s.store_class_end();
  }
}

void pageBlockPhoto::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockPhoto").c_str());
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockVideo::Class;
jfieldID pageBlockVideo::video_fieldID;
jfieldID pageBlockVideo::caption_fieldID;
jfieldID pageBlockVideo::need_autoplay_fieldID;
jfieldID pageBlockVideo::is_looped_fieldID;

pageBlockVideo::pageBlockVideo()
  : video_()
  , caption_()
  , need_autoplay_()
  , is_looped_()
{}

pageBlockVideo::pageBlockVideo(object_ptr<video> &&video_, object_ptr<pageBlockCaption> &&caption_, bool need_autoplay_, bool is_looped_)
  : video_(std::move(video_))
  , caption_(std::move(caption_))
  , need_autoplay_(need_autoplay_)
  , is_looped_(is_looped_)
{}

const std::int32_t pageBlockVideo::ID;

object_ptr<PageBlock> pageBlockVideo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockVideo> res = make_object<pageBlockVideo>();
  res->video_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_fieldID));
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->need_autoplay_ = (env->GetBooleanField(p, res->need_autoplay_fieldID) != 0);
  res->is_looped_ = (env->GetBooleanField(p, res->is_looped_fieldID) != 0);
  return std::move(res);
}

void pageBlockVideo::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 (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, need_autoplay_fieldID, need_autoplay_);
  env->SetBooleanField(s, is_looped_fieldID, is_looped_);
}

void pageBlockVideo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockVideo");
    s.store_object_field("video", static_cast<const BaseObject *>(video_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("needAutoplay", need_autoplay_);
    s.store_field("isLooped", is_looped_);
    s.store_class_end();
  }
}

void pageBlockVideo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockVideo").c_str());
    video_fieldID = jni::get_field_id(env, Class, "video", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    need_autoplay_fieldID = jni::get_field_id(env, Class, "needAutoplay", "Z");
    is_looped_fieldID = jni::get_field_id(env, Class, "isLooped", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockVoiceNote::Class;
jfieldID pageBlockVoiceNote::voice_note_fieldID;
jfieldID pageBlockVoiceNote::caption_fieldID;

pageBlockVoiceNote::pageBlockVoiceNote()
  : voice_note_()
  , caption_()
{}

pageBlockVoiceNote::pageBlockVoiceNote(object_ptr<voiceNote> &&voice_note_, object_ptr<pageBlockCaption> &&caption_)
  : voice_note_(std::move(voice_note_))
  , caption_(std::move(caption_))
{}

const std::int32_t pageBlockVoiceNote::ID;

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

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

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

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

jclass pageBlockCover::Class;
jfieldID pageBlockCover::cover_fieldID;

pageBlockCover::pageBlockCover()
  : cover_()
{}

pageBlockCover::pageBlockCover(object_ptr<PageBlock> &&cover_)
  : cover_(std::move(cover_))
{}

const std::int32_t pageBlockCover::ID;

object_ptr<PageBlock> pageBlockCover::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockCover> res = make_object<pageBlockCover>();
  res->cover_ = jni::fetch_tl_object<PageBlock>(env, jni::fetch_object(env, p, res->cover_fieldID));
  return std::move(res);
}

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

void pageBlockCover::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockCover");
    s.store_object_field("cover", static_cast<const BaseObject *>(cover_.get()));
    s.store_class_end();
  }
}

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

jclass pageBlockEmbedded::Class;
jfieldID pageBlockEmbedded::url_fieldID;
jfieldID pageBlockEmbedded::html_fieldID;
jfieldID pageBlockEmbedded::poster_photo_fieldID;
jfieldID pageBlockEmbedded::width_fieldID;
jfieldID pageBlockEmbedded::height_fieldID;
jfieldID pageBlockEmbedded::caption_fieldID;
jfieldID pageBlockEmbedded::is_full_width_fieldID;
jfieldID pageBlockEmbedded::allow_scrolling_fieldID;

pageBlockEmbedded::pageBlockEmbedded()
  : url_()
  , html_()
  , poster_photo_()
  , width_()
  , height_()
  , caption_()
  , is_full_width_()
  , allow_scrolling_()
{}

pageBlockEmbedded::pageBlockEmbedded(string const &url_, string const &html_, object_ptr<photo> &&poster_photo_, int32 width_, int32 height_, object_ptr<pageBlockCaption> &&caption_, bool is_full_width_, bool allow_scrolling_)
  : url_(url_)
  , html_(html_)
  , poster_photo_(std::move(poster_photo_))
  , width_(width_)
  , height_(height_)
  , caption_(std::move(caption_))
  , is_full_width_(is_full_width_)
  , allow_scrolling_(allow_scrolling_)
{}

const std::int32_t pageBlockEmbedded::ID;

object_ptr<PageBlock> pageBlockEmbedded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockEmbedded> res = make_object<pageBlockEmbedded>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->html_ = jni::fetch_string(env, p, res->html_fieldID);
  res->poster_photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->poster_photo_fieldID));
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->is_full_width_ = (env->GetBooleanField(p, res->is_full_width_fieldID) != 0);
  res->allow_scrolling_ = (env->GetBooleanField(p, res->allow_scrolling_fieldID) != 0);
  return std::move(res);
}

void pageBlockEmbedded::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, html_); if (nextString) { env->SetObjectField(s, html_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (poster_photo_ != nullptr) { jobject next; poster_photo_->store(env, next); if (next) { env->SetObjectField(s, poster_photo_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, is_full_width_fieldID, is_full_width_);
  env->SetBooleanField(s, allow_scrolling_fieldID, allow_scrolling_);
}

void pageBlockEmbedded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockEmbedded");
    s.store_field("url", url_);
    s.store_field("html", html_);
    s.store_object_field("posterPhoto", static_cast<const BaseObject *>(poster_photo_.get()));
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_field("isFullWidth", is_full_width_);
    s.store_field("allowScrolling", allow_scrolling_);
    s.store_class_end();
  }
}

void pageBlockEmbedded::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockEmbedded").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    html_fieldID = jni::get_field_id(env, Class, "html", "Ljava/lang/String;");
    poster_photo_fieldID = jni::get_field_id(env, Class, "posterPhoto", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    is_full_width_fieldID = jni::get_field_id(env, Class, "isFullWidth", "Z");
    allow_scrolling_fieldID = jni::get_field_id(env, Class, "allowScrolling", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockEmbeddedPost::Class;
jfieldID pageBlockEmbeddedPost::url_fieldID;
jfieldID pageBlockEmbeddedPost::author_fieldID;
jfieldID pageBlockEmbeddedPost::author_photo_fieldID;
jfieldID pageBlockEmbeddedPost::date_fieldID;
jfieldID pageBlockEmbeddedPost::page_blocks_fieldID;
jfieldID pageBlockEmbeddedPost::caption_fieldID;

pageBlockEmbeddedPost::pageBlockEmbeddedPost()
  : url_()
  , author_()
  , author_photo_()
  , date_()
  , page_blocks_()
  , caption_()
{}

pageBlockEmbeddedPost::pageBlockEmbeddedPost(string const &url_, string const &author_, object_ptr<photo> &&author_photo_, int32 date_, array<object_ptr<PageBlock>> &&page_blocks_, object_ptr<pageBlockCaption> &&caption_)
  : url_(url_)
  , author_(author_)
  , author_photo_(std::move(author_photo_))
  , date_(date_)
  , page_blocks_(std::move(page_blocks_))
  , caption_(std::move(caption_))
{}

const std::int32_t pageBlockEmbeddedPost::ID;

object_ptr<PageBlock> pageBlockEmbeddedPost::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockEmbeddedPost> res = make_object<pageBlockEmbeddedPost>();
  res->url_ = jni::fetch_string(env, p, res->url_fieldID);
  res->author_ = jni::fetch_string(env, p, res->author_fieldID);
  res->author_photo_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->author_photo_fieldID));
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->page_blocks_ = jni::FetchVector<PageBlock>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->page_blocks_fieldID));
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void pageBlockEmbeddedPost::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, url_); if (nextString) { env->SetObjectField(s, url_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, author_); if (nextString) { env->SetObjectField(s, author_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (author_photo_ != nullptr) { jobject next; author_photo_->store(env, next); if (next) { env->SetObjectField(s, author_photo_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, date_fieldID, date_);
  { auto arr_tmp_ = jni::store_vector(env, page_blocks_); if (arr_tmp_) { env->SetObjectField(s, page_blocks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void pageBlockEmbeddedPost::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockEmbeddedPost");
    s.store_field("url", url_);
    s.store_field("author", author_);
    s.store_object_field("authorPhoto", static_cast<const BaseObject *>(author_photo_.get()));
    s.store_field("date", date_);
    { s.store_vector_begin("pageBlocks", page_blocks_.size()); for (const auto &_value : page_blocks_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_class_end();
  }
}

void pageBlockEmbeddedPost::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockEmbeddedPost").c_str());
    url_fieldID = jni::get_field_id(env, Class, "url", "Ljava/lang/String;");
    author_fieldID = jni::get_field_id(env, Class, "author", "Ljava/lang/String;");
    author_photo_fieldID = jni::get_field_id(env, Class, "authorPhoto", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    page_blocks_fieldID = jni::get_field_id(env, Class, "pageBlocks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PageBlock;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockCollage::Class;
jfieldID pageBlockCollage::page_blocks_fieldID;
jfieldID pageBlockCollage::caption_fieldID;

pageBlockCollage::pageBlockCollage()
  : page_blocks_()
  , caption_()
{}

pageBlockCollage::pageBlockCollage(array<object_ptr<PageBlock>> &&page_blocks_, object_ptr<pageBlockCaption> &&caption_)
  : page_blocks_(std::move(page_blocks_))
  , caption_(std::move(caption_))
{}

const std::int32_t pageBlockCollage::ID;

object_ptr<PageBlock> pageBlockCollage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockCollage> res = make_object<pageBlockCollage>();
  res->page_blocks_ = jni::FetchVector<PageBlock>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->page_blocks_fieldID));
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void pageBlockCollage::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, page_blocks_); if (arr_tmp_) { env->SetObjectField(s, page_blocks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

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

void pageBlockCollage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockCollage").c_str());
    page_blocks_fieldID = jni::get_field_id(env, Class, "pageBlocks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PageBlock;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockSlideshow::Class;
jfieldID pageBlockSlideshow::page_blocks_fieldID;
jfieldID pageBlockSlideshow::caption_fieldID;

pageBlockSlideshow::pageBlockSlideshow()
  : page_blocks_()
  , caption_()
{}

pageBlockSlideshow::pageBlockSlideshow(array<object_ptr<PageBlock>> &&page_blocks_, object_ptr<pageBlockCaption> &&caption_)
  : page_blocks_(std::move(page_blocks_))
  , caption_(std::move(caption_))
{}

const std::int32_t pageBlockSlideshow::ID;

object_ptr<PageBlock> pageBlockSlideshow::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockSlideshow> res = make_object<pageBlockSlideshow>();
  res->page_blocks_ = jni::FetchVector<PageBlock>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->page_blocks_fieldID));
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void pageBlockSlideshow::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, page_blocks_); if (arr_tmp_) { env->SetObjectField(s, page_blocks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

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

void pageBlockSlideshow::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockSlideshow").c_str());
    page_blocks_fieldID = jni::get_field_id(env, Class, "pageBlocks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PageBlock;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockChatLink::Class;
jfieldID pageBlockChatLink::title_fieldID;
jfieldID pageBlockChatLink::photo_fieldID;
jfieldID pageBlockChatLink::accent_color_id_fieldID;
jfieldID pageBlockChatLink::username_fieldID;

pageBlockChatLink::pageBlockChatLink()
  : title_()
  , photo_()
  , accent_color_id_()
  , username_()
{}

pageBlockChatLink::pageBlockChatLink(string const &title_, object_ptr<chatPhotoInfo> &&photo_, int32 accent_color_id_, string const &username_)
  : title_(title_)
  , photo_(std::move(photo_))
  , accent_color_id_(accent_color_id_)
  , username_(username_)
{}

const std::int32_t pageBlockChatLink::ID;

object_ptr<PageBlock> pageBlockChatLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockChatLink> res = make_object<pageBlockChatLink>();
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->photo_ = jni::fetch_tl_object<chatPhotoInfo>(env, jni::fetch_object(env, p, res->photo_fieldID));
  res->accent_color_id_ = env->GetIntField(p, res->accent_color_id_fieldID);
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  return std::move(res);
}

void pageBlockChatLink::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (photo_ != nullptr) { jobject next; photo_->store(env, next); if (next) { env->SetObjectField(s, photo_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, accent_color_id_fieldID, accent_color_id_);
  { jstring nextString = jni::to_jstring(env, username_); if (nextString) { env->SetObjectField(s, username_fieldID, nextString); env->DeleteLocalRef(nextString); } }
}

void pageBlockChatLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockChatLink");
    s.store_field("title", title_);
    s.store_object_field("photo", static_cast<const BaseObject *>(photo_.get()));
    s.store_field("accentColorId", accent_color_id_);
    s.store_field("username", username_);
    s.store_class_end();
  }
}

void pageBlockChatLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockChatLink").c_str());
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    photo_fieldID = jni::get_field_id(env, Class, "photo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatPhotoInfo;").c_str());
    accent_color_id_fieldID = jni::get_field_id(env, Class, "accentColorId", "I");
    username_fieldID = jni::get_field_id(env, Class, "username", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockTable::Class;
jfieldID pageBlockTable::caption_fieldID;
jfieldID pageBlockTable::cells_fieldID;
jfieldID pageBlockTable::is_bordered_fieldID;
jfieldID pageBlockTable::is_striped_fieldID;

pageBlockTable::pageBlockTable()
  : caption_()
  , cells_()
  , is_bordered_()
  , is_striped_()
{}

pageBlockTable::pageBlockTable(object_ptr<RichText> &&caption_, array<array<object_ptr<pageBlockTableCell>>> &&cells_, bool is_bordered_, bool is_striped_)
  : caption_(std::move(caption_))
  , cells_(std::move(cells_))
  , is_bordered_(is_bordered_)
  , is_striped_(is_striped_)
{}

const std::int32_t pageBlockTable::ID;

object_ptr<PageBlock> pageBlockTable::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockTable> res = make_object<pageBlockTable>();
  res->caption_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->cells_ = jni::FetchVector<array<pageBlockTableCell>>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->cells_fieldID));
  res->is_bordered_ = (env->GetBooleanField(p, res->is_bordered_fieldID) != 0);
  res->is_striped_ = (env->GetBooleanField(p, res->is_striped_fieldID) != 0);
  return std::move(res);
}

void pageBlockTable::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, cells_); if (arr_tmp_) { env->SetObjectField(s, cells_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_bordered_fieldID, is_bordered_);
  env->SetBooleanField(s, is_striped_fieldID, is_striped_);
}

void pageBlockTable::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockTable");
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    { s.store_vector_begin("cells", cells_.size()); for (const auto &_value : cells_) { { s.store_vector_begin("", _value.size()); for (const auto &_value2 : _value) { s.store_object_field("", static_cast<const BaseObject *>(_value2.get())); } s.store_class_end(); } } s.store_class_end(); }
    s.store_field("isBordered", is_bordered_);
    s.store_field("isStriped", is_striped_);
    s.store_class_end();
  }
}

void pageBlockTable::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockTable").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    cells_fieldID = jni::get_field_id(env, Class, "cells", (PSLICE() << "[[L" << get_package_name_ref() << "/TdApi$PageBlockTableCell;").c_str());
    is_bordered_fieldID = jni::get_field_id(env, Class, "isBordered", "Z");
    is_striped_fieldID = jni::get_field_id(env, Class, "isStriped", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockDetails::Class;
jfieldID pageBlockDetails::header_fieldID;
jfieldID pageBlockDetails::page_blocks_fieldID;
jfieldID pageBlockDetails::is_open_fieldID;

pageBlockDetails::pageBlockDetails()
  : header_()
  , page_blocks_()
  , is_open_()
{}

pageBlockDetails::pageBlockDetails(object_ptr<RichText> &&header_, array<object_ptr<PageBlock>> &&page_blocks_, bool is_open_)
  : header_(std::move(header_))
  , page_blocks_(std::move(page_blocks_))
  , is_open_(is_open_)
{}

const std::int32_t pageBlockDetails::ID;

object_ptr<PageBlock> pageBlockDetails::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockDetails> res = make_object<pageBlockDetails>();
  res->header_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->header_fieldID));
  res->page_blocks_ = jni::FetchVector<PageBlock>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->page_blocks_fieldID));
  res->is_open_ = (env->GetBooleanField(p, res->is_open_fieldID) != 0);
  return std::move(res);
}

void pageBlockDetails::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (header_ != nullptr) { jobject next; header_->store(env, next); if (next) { env->SetObjectField(s, header_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, page_blocks_); if (arr_tmp_) { env->SetObjectField(s, page_blocks_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_open_fieldID, is_open_);
}

void pageBlockDetails::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockDetails");
    s.store_object_field("header", static_cast<const BaseObject *>(header_.get()));
    { s.store_vector_begin("pageBlocks", page_blocks_.size()); for (const auto &_value : page_blocks_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("isOpen", is_open_);
    s.store_class_end();
  }
}

void pageBlockDetails::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockDetails").c_str());
    header_fieldID = jni::get_field_id(env, Class, "header", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    page_blocks_fieldID = jni::get_field_id(env, Class, "pageBlocks", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PageBlock;").c_str());
    is_open_fieldID = jni::get_field_id(env, Class, "isOpen", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockRelatedArticles::Class;
jfieldID pageBlockRelatedArticles::header_fieldID;
jfieldID pageBlockRelatedArticles::articles_fieldID;

pageBlockRelatedArticles::pageBlockRelatedArticles()
  : header_()
  , articles_()
{}

pageBlockRelatedArticles::pageBlockRelatedArticles(object_ptr<RichText> &&header_, array<object_ptr<pageBlockRelatedArticle>> &&articles_)
  : header_(std::move(header_))
  , articles_(std::move(articles_))
{}

const std::int32_t pageBlockRelatedArticles::ID;

object_ptr<PageBlock> pageBlockRelatedArticles::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockRelatedArticles> res = make_object<pageBlockRelatedArticles>();
  res->header_ = jni::fetch_tl_object<RichText>(env, jni::fetch_object(env, p, res->header_fieldID));
  res->articles_ = jni::FetchVector<pageBlockRelatedArticle>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->articles_fieldID));
  return std::move(res);
}

void pageBlockRelatedArticles::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (header_ != nullptr) { jobject next; header_->store(env, next); if (next) { env->SetObjectField(s, header_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, articles_); if (arr_tmp_) { env->SetObjectField(s, articles_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void pageBlockRelatedArticles::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockRelatedArticles");
    s.store_object_field("header", static_cast<const BaseObject *>(header_.get()));
    { s.store_vector_begin("articles", articles_.size()); for (const auto &_value : articles_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

void pageBlockRelatedArticles::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockRelatedArticles").c_str());
    header_fieldID = jni::get_field_id(env, Class, "header", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$RichText;").c_str());
    articles_fieldID = jni::get_field_id(env, Class, "articles", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$PageBlockRelatedArticle;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass pageBlockMap::Class;
jfieldID pageBlockMap::location_fieldID;
jfieldID pageBlockMap::zoom_fieldID;
jfieldID pageBlockMap::width_fieldID;
jfieldID pageBlockMap::height_fieldID;
jfieldID pageBlockMap::caption_fieldID;

pageBlockMap::pageBlockMap()
  : location_()
  , zoom_()
  , width_()
  , height_()
  , caption_()
{}

pageBlockMap::pageBlockMap(object_ptr<location> &&location_, int32 zoom_, int32 width_, int32 height_, object_ptr<pageBlockCaption> &&caption_)
  : location_(std::move(location_))
  , zoom_(zoom_)
  , width_(width_)
  , height_(height_)
  , caption_(std::move(caption_))
{}

const std::int32_t pageBlockMap::ID;

object_ptr<PageBlock> pageBlockMap::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pageBlockMap> res = make_object<pageBlockMap>();
  res->location_ = jni::fetch_tl_object<location>(env, jni::fetch_object(env, p, res->location_fieldID));
  res->zoom_ = env->GetIntField(p, res->zoom_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->caption_ = jni::fetch_tl_object<pageBlockCaption>(env, jni::fetch_object(env, p, res->caption_fieldID));
  return std::move(res);
}

void pageBlockMap::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (location_ != nullptr) { jobject next; location_->store(env, next); if (next) { env->SetObjectField(s, location_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, zoom_fieldID, zoom_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  if (caption_ != nullptr) { jobject next; caption_->store(env, next); if (next) { env->SetObjectField(s, caption_fieldID, next); env->DeleteLocalRef(next); } }
}

void pageBlockMap::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PageBlockMap");
    s.store_object_field("location", static_cast<const BaseObject *>(location_.get()));
    s.store_field("zoom", zoom_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_class_end();
  }
}

void pageBlockMap::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PageBlockMap").c_str());
    location_fieldID = jni::get_field_id(env, Class, "location", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Location;").c_str());
    zoom_fieldID = jni::get_field_id(env, Class, "zoom", "I");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$PageBlockCaption;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PageBlockVerticalAlignment::Class;

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

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

jclass pageBlockVerticalAlignmentTop::Class;

pageBlockVerticalAlignmentTop::pageBlockVerticalAlignmentTop() {
}

const std::int32_t pageBlockVerticalAlignmentTop::ID;

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

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

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

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

jclass pageBlockVerticalAlignmentMiddle::Class;

pageBlockVerticalAlignmentMiddle::pageBlockVerticalAlignmentMiddle() {
}

const std::int32_t pageBlockVerticalAlignmentMiddle::ID;

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

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

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

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

jclass pageBlockVerticalAlignmentBottom::Class;

pageBlockVerticalAlignmentBottom::pageBlockVerticalAlignmentBottom() {
}

const std::int32_t pageBlockVerticalAlignmentBottom::ID;

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

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

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

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

jclass PaidReactionType::Class;

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

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

jclass paidReactionTypeRegular::Class;

paidReactionTypeRegular::paidReactionTypeRegular() {
}

const std::int32_t paidReactionTypeRegular::ID;

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

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

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

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

jclass paidReactionTypeAnonymous::Class;

paidReactionTypeAnonymous::paidReactionTypeAnonymous() {
}

const std::int32_t paidReactionTypeAnonymous::ID;

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

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

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

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

jclass paidReactionTypeChat::Class;
jfieldID paidReactionTypeChat::chat_id_fieldID;

paidReactionTypeChat::paidReactionTypeChat()
  : chat_id_()
{}

paidReactionTypeChat::paidReactionTypeChat(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t paidReactionTypeChat::ID;

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

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

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

jclass passkeys::Class;
jfieldID passkeys::passkeys_fieldID;

passkeys::passkeys()
  : passkeys_()
{}

passkeys::passkeys(array<object_ptr<passkey>> &&passkeys_)
  : passkeys_(std::move(passkeys_))
{}

const std::int32_t passkeys::ID;

object_ptr<passkeys> passkeys::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<passkeys> res = make_object<passkeys>();
  res->passkeys_ = jni::FetchVector<passkey>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->passkeys_fieldID));
  return res;
}

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

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

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

jclass passportElementsWithErrors::Class;
jfieldID passportElementsWithErrors::elements_fieldID;
jfieldID passportElementsWithErrors::errors_fieldID;

passportElementsWithErrors::passportElementsWithErrors()
  : elements_()
  , errors_()
{}

passportElementsWithErrors::passportElementsWithErrors(array<object_ptr<PassportElement>> &&elements_, array<object_ptr<passportElementError>> &&errors_)
  : elements_(std::move(elements_))
  , errors_(std::move(errors_))
{}

const std::int32_t passportElementsWithErrors::ID;

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

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

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

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

jclass pollOption::Class;
jfieldID pollOption::id_fieldID;
jfieldID pollOption::text_fieldID;
jfieldID pollOption::media_fieldID;
jfieldID pollOption::voter_count_fieldID;
jfieldID pollOption::vote_percentage_fieldID;
jfieldID pollOption::recent_voter_ids_fieldID;
jfieldID pollOption::is_chosen_fieldID;
jfieldID pollOption::is_being_chosen_fieldID;
jfieldID pollOption::author_fieldID;
jfieldID pollOption::addition_date_fieldID;

pollOption::pollOption()
  : id_()
  , text_()
  , media_()
  , voter_count_()
  , vote_percentage_()
  , recent_voter_ids_()
  , is_chosen_()
  , is_being_chosen_()
  , author_()
  , addition_date_()
{}

pollOption::pollOption(string const &id_, object_ptr<formattedText> &&text_, object_ptr<MessageContent> &&media_, int32 voter_count_, int32 vote_percentage_, array<object_ptr<MessageSender>> &&recent_voter_ids_, bool is_chosen_, bool is_being_chosen_, object_ptr<MessageSender> &&author_, int32 addition_date_)
  : id_(id_)
  , text_(std::move(text_))
  , media_(std::move(media_))
  , voter_count_(voter_count_)
  , vote_percentage_(vote_percentage_)
  , recent_voter_ids_(std::move(recent_voter_ids_))
  , is_chosen_(is_chosen_)
  , is_being_chosen_(is_being_chosen_)
  , author_(std::move(author_))
  , addition_date_(addition_date_)
{}

const std::int32_t pollOption::ID;

object_ptr<pollOption> pollOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pollOption> res = make_object<pollOption>();
  res->id_ = jni::fetch_string(env, p, res->id_fieldID);
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->media_ = jni::fetch_tl_object<MessageContent>(env, jni::fetch_object(env, p, res->media_fieldID));
  res->voter_count_ = env->GetIntField(p, res->voter_count_fieldID);
  res->vote_percentage_ = env->GetIntField(p, res->vote_percentage_fieldID);
  res->recent_voter_ids_ = jni::FetchVector<MessageSender>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->recent_voter_ids_fieldID));
  res->is_chosen_ = (env->GetBooleanField(p, res->is_chosen_fieldID) != 0);
  res->is_being_chosen_ = (env->GetBooleanField(p, res->is_being_chosen_fieldID) != 0);
  res->author_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->author_fieldID));
  res->addition_date_ = env->GetIntField(p, res->addition_date_fieldID);
  return res;
}

void pollOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, id_); if (nextString) { env->SetObjectField(s, id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  if (media_ != nullptr) { jobject next; media_->store(env, next); if (next) { env->SetObjectField(s, media_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, voter_count_fieldID, voter_count_);
  env->SetIntField(s, vote_percentage_fieldID, vote_percentage_);
  { auto arr_tmp_ = jni::store_vector(env, recent_voter_ids_); if (arr_tmp_) { env->SetObjectField(s, recent_voter_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetBooleanField(s, is_chosen_fieldID, is_chosen_);
  env->SetBooleanField(s, is_being_chosen_fieldID, is_being_chosen_);
  if (author_ != nullptr) { jobject next; author_->store(env, next); if (next) { env->SetObjectField(s, author_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, addition_date_fieldID, addition_date_);
}

void pollOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PollOption");
    s.store_field("id", id_);
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_object_field("media", static_cast<const BaseObject *>(media_.get()));
    s.store_field("voterCount", voter_count_);
    s.store_field("votePercentage", vote_percentage_);
    { s.store_vector_begin("recentVoterIds", recent_voter_ids_.size()); for (const auto &_value : recent_voter_ids_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("isChosen", is_chosen_);
    s.store_field("isBeingChosen", is_being_chosen_);
    s.store_object_field("author", static_cast<const BaseObject *>(author_.get()));
    s.store_field("additionDate", addition_date_);
    s.store_class_end();
  }
}

void pollOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PollOption").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "Ljava/lang/String;");
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    media_fieldID = jni::get_field_id(env, Class, "media", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageContent;").c_str());
    voter_count_fieldID = jni::get_field_id(env, Class, "voterCount", "I");
    vote_percentage_fieldID = jni::get_field_id(env, Class, "votePercentage", "I");
    recent_voter_ids_fieldID = jni::get_field_id(env, Class, "recentVoterIds", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    is_chosen_fieldID = jni::get_field_id(env, Class, "isChosen", "Z");
    is_being_chosen_fieldID = jni::get_field_id(env, Class, "isBeingChosen", "Z");
    author_fieldID = jni::get_field_id(env, Class, "author", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    addition_date_fieldID = jni::get_field_id(env, Class, "additionDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass premiumGiveawayPaymentOption::Class;
jfieldID premiumGiveawayPaymentOption::currency_fieldID;
jfieldID premiumGiveawayPaymentOption::amount_fieldID;
jfieldID premiumGiveawayPaymentOption::winner_count_fieldID;
jfieldID premiumGiveawayPaymentOption::month_count_fieldID;
jfieldID premiumGiveawayPaymentOption::store_product_id_fieldID;
jfieldID premiumGiveawayPaymentOption::store_product_quantity_fieldID;

premiumGiveawayPaymentOption::premiumGiveawayPaymentOption()
  : currency_()
  , amount_()
  , winner_count_()
  , month_count_()
  , store_product_id_()
  , store_product_quantity_()
{}

premiumGiveawayPaymentOption::premiumGiveawayPaymentOption(string const &currency_, int53 amount_, int32 winner_count_, int32 month_count_, string const &store_product_id_, int32 store_product_quantity_)
  : currency_(currency_)
  , amount_(amount_)
  , winner_count_(winner_count_)
  , month_count_(month_count_)
  , store_product_id_(store_product_id_)
  , store_product_quantity_(store_product_quantity_)
{}

const std::int32_t premiumGiveawayPaymentOption::ID;

object_ptr<premiumGiveawayPaymentOption> premiumGiveawayPaymentOption::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumGiveawayPaymentOption> res = make_object<premiumGiveawayPaymentOption>();
  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->month_count_ = env->GetIntField(p, res->month_count_fieldID);
  res->store_product_id_ = jni::fetch_string(env, p, res->store_product_id_fieldID);
  res->store_product_quantity_ = env->GetIntField(p, res->store_product_quantity_fieldID);
  return res;
}

void premiumGiveawayPaymentOption::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, currency_); if (nextString) { env->SetObjectField(s, currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, amount_fieldID, amount_);
  env->SetIntField(s, winner_count_fieldID, winner_count_);
  env->SetIntField(s, month_count_fieldID, month_count_);
  { jstring nextString = jni::to_jstring(env, store_product_id_); if (nextString) { env->SetObjectField(s, store_product_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, store_product_quantity_fieldID, store_product_quantity_);
}

void premiumGiveawayPaymentOption::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumGiveawayPaymentOption");
    s.store_field("currency", currency_);
    s.store_field("amount", amount_);
    s.store_field("winnerCount", winner_count_);
    s.store_field("monthCount", month_count_);
    s.store_field("storeProductId", store_product_id_);
    s.store_field("storeProductQuantity", store_product_quantity_);
    s.store_class_end();
  }
}

void premiumGiveawayPaymentOption::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$PremiumGiveawayPaymentOption").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");
    month_count_fieldID = jni::get_field_id(env, Class, "monthCount", "I");
    store_product_id_fieldID = jni::get_field_id(env, Class, "storeProductId", "Ljava/lang/String;");
    store_product_quantity_fieldID = jni::get_field_id(env, Class, "storeProductQuantity", "I");
    return true;
  }();
  (void)is_inited;
}

jclass PremiumLimitType::Class;

object_ptr<PremiumLimitType> PremiumLimitType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case premiumLimitTypeSupergroupCount::ID:
      return premiumLimitTypeSupergroupCount::fetch(env, p);
    case premiumLimitTypePinnedChatCount::ID:
      return premiumLimitTypePinnedChatCount::fetch(env, p);
    case premiumLimitTypeCreatedPublicChatCount::ID:
      return premiumLimitTypeCreatedPublicChatCount::fetch(env, p);
    case premiumLimitTypeSavedAnimationCount::ID:
      return premiumLimitTypeSavedAnimationCount::fetch(env, p);
    case premiumLimitTypeFavoriteStickerCount::ID:
      return premiumLimitTypeFavoriteStickerCount::fetch(env, p);
    case premiumLimitTypeChatFolderCount::ID:
      return premiumLimitTypeChatFolderCount::fetch(env, p);
    case premiumLimitTypeChatFolderChosenChatCount::ID:
      return premiumLimitTypeChatFolderChosenChatCount::fetch(env, p);
    case premiumLimitTypePinnedArchivedChatCount::ID:
      return premiumLimitTypePinnedArchivedChatCount::fetch(env, p);
    case premiumLimitTypePinnedSavedMessagesTopicCount::ID:
      return premiumLimitTypePinnedSavedMessagesTopicCount::fetch(env, p);
    case premiumLimitTypeCaptionLength::ID:
      return premiumLimitTypeCaptionLength::fetch(env, p);
    case premiumLimitTypeBioLength::ID:
      return premiumLimitTypeBioLength::fetch(env, p);
    case premiumLimitTypeChatFolderInviteLinkCount::ID:
      return premiumLimitTypeChatFolderInviteLinkCount::fetch(env, p);
    case premiumLimitTypeShareableChatFolderCount::ID:
      return premiumLimitTypeShareableChatFolderCount::fetch(env, p);
    case premiumLimitTypeActiveStoryCount::ID:
      return premiumLimitTypeActiveStoryCount::fetch(env, p);
    case premiumLimitTypeWeeklyPostedStoryCount::ID:
      return premiumLimitTypeWeeklyPostedStoryCount::fetch(env, p);
    case premiumLimitTypeMonthlyPostedStoryCount::ID:
      return premiumLimitTypeMonthlyPostedStoryCount::fetch(env, p);
    case premiumLimitTypeStoryCaptionLength::ID:
      return premiumLimitTypeStoryCaptionLength::fetch(env, p);
    case premiumLimitTypeStorySuggestedReactionAreaCount::ID:
      return premiumLimitTypeStorySuggestedReactionAreaCount::fetch(env, p);
    case premiumLimitTypeSimilarChatCount::ID:
      return premiumLimitTypeSimilarChatCount::fetch(env, p);
    case premiumLimitTypeOwnedBotCount::ID:
      return premiumLimitTypeOwnedBotCount::fetch(env, p);
    case premiumLimitTypeCustomTextCompositionStyleCount::ID:
      return premiumLimitTypeCustomTextCompositionStyleCount::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass premiumLimitTypeSupergroupCount::Class;

premiumLimitTypeSupergroupCount::premiumLimitTypeSupergroupCount() {
}

const std::int32_t premiumLimitTypeSupergroupCount::ID;

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

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

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

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

jclass premiumLimitTypePinnedChatCount::Class;

premiumLimitTypePinnedChatCount::premiumLimitTypePinnedChatCount() {
}

const std::int32_t premiumLimitTypePinnedChatCount::ID;

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

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

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

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

jclass premiumLimitTypeCreatedPublicChatCount::Class;

premiumLimitTypeCreatedPublicChatCount::premiumLimitTypeCreatedPublicChatCount() {
}

const std::int32_t premiumLimitTypeCreatedPublicChatCount::ID;

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

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

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

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

jclass premiumLimitTypeSavedAnimationCount::Class;

premiumLimitTypeSavedAnimationCount::premiumLimitTypeSavedAnimationCount() {
}

const std::int32_t premiumLimitTypeSavedAnimationCount::ID;

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

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

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

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

jclass premiumLimitTypeFavoriteStickerCount::Class;

premiumLimitTypeFavoriteStickerCount::premiumLimitTypeFavoriteStickerCount() {
}

const std::int32_t premiumLimitTypeFavoriteStickerCount::ID;

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

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

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

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

jclass premiumLimitTypeChatFolderCount::Class;

premiumLimitTypeChatFolderCount::premiumLimitTypeChatFolderCount() {
}

const std::int32_t premiumLimitTypeChatFolderCount::ID;

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

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

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

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

jclass premiumLimitTypeChatFolderChosenChatCount::Class;

premiumLimitTypeChatFolderChosenChatCount::premiumLimitTypeChatFolderChosenChatCount() {
}

const std::int32_t premiumLimitTypeChatFolderChosenChatCount::ID;

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

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

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

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

jclass premiumLimitTypePinnedArchivedChatCount::Class;

premiumLimitTypePinnedArchivedChatCount::premiumLimitTypePinnedArchivedChatCount() {
}

const std::int32_t premiumLimitTypePinnedArchivedChatCount::ID;

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

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

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

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

jclass premiumLimitTypePinnedSavedMessagesTopicCount::Class;

premiumLimitTypePinnedSavedMessagesTopicCount::premiumLimitTypePinnedSavedMessagesTopicCount() {
}

const std::int32_t premiumLimitTypePinnedSavedMessagesTopicCount::ID;

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

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

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

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

jclass premiumLimitTypeCaptionLength::Class;

premiumLimitTypeCaptionLength::premiumLimitTypeCaptionLength() {
}

const std::int32_t premiumLimitTypeCaptionLength::ID;

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

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

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

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

jclass premiumLimitTypeBioLength::Class;

premiumLimitTypeBioLength::premiumLimitTypeBioLength() {
}

const std::int32_t premiumLimitTypeBioLength::ID;

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

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

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

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

jclass premiumLimitTypeChatFolderInviteLinkCount::Class;

premiumLimitTypeChatFolderInviteLinkCount::premiumLimitTypeChatFolderInviteLinkCount() {
}

const std::int32_t premiumLimitTypeChatFolderInviteLinkCount::ID;

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

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

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

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

jclass premiumLimitTypeShareableChatFolderCount::Class;

premiumLimitTypeShareableChatFolderCount::premiumLimitTypeShareableChatFolderCount() {
}

const std::int32_t premiumLimitTypeShareableChatFolderCount::ID;

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

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

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

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

jclass premiumLimitTypeActiveStoryCount::Class;

premiumLimitTypeActiveStoryCount::premiumLimitTypeActiveStoryCount() {
}

const std::int32_t premiumLimitTypeActiveStoryCount::ID;

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

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

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

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

jclass premiumLimitTypeWeeklyPostedStoryCount::Class;

premiumLimitTypeWeeklyPostedStoryCount::premiumLimitTypeWeeklyPostedStoryCount() {
}

const std::int32_t premiumLimitTypeWeeklyPostedStoryCount::ID;

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

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

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

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

jclass premiumLimitTypeMonthlyPostedStoryCount::Class;

premiumLimitTypeMonthlyPostedStoryCount::premiumLimitTypeMonthlyPostedStoryCount() {
}

const std::int32_t premiumLimitTypeMonthlyPostedStoryCount::ID;

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

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

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

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

jclass premiumLimitTypeStoryCaptionLength::Class;

premiumLimitTypeStoryCaptionLength::premiumLimitTypeStoryCaptionLength() {
}

const std::int32_t premiumLimitTypeStoryCaptionLength::ID;

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

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

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

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

jclass premiumLimitTypeStorySuggestedReactionAreaCount::Class;

premiumLimitTypeStorySuggestedReactionAreaCount::premiumLimitTypeStorySuggestedReactionAreaCount() {
}

const std::int32_t premiumLimitTypeStorySuggestedReactionAreaCount::ID;

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

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

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

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

jclass premiumLimitTypeSimilarChatCount::Class;

premiumLimitTypeSimilarChatCount::premiumLimitTypeSimilarChatCount() {
}

const std::int32_t premiumLimitTypeSimilarChatCount::ID;

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

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

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

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

jclass premiumLimitTypeOwnedBotCount::Class;

premiumLimitTypeOwnedBotCount::premiumLimitTypeOwnedBotCount() {
}

const std::int32_t premiumLimitTypeOwnedBotCount::ID;

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

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

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

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

jclass premiumLimitTypeCustomTextCompositionStyleCount::Class;

premiumLimitTypeCustomTextCompositionStyleCount::premiumLimitTypeCustomTextCompositionStyleCount() {
}

const std::int32_t premiumLimitTypeCustomTextCompositionStyleCount::ID;

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

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

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

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

jclass PremiumSource::Class;

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

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

jclass premiumSourceLimitExceeded::Class;
jfieldID premiumSourceLimitExceeded::limit_type_fieldID;

premiumSourceLimitExceeded::premiumSourceLimitExceeded()
  : limit_type_()
{}

premiumSourceLimitExceeded::premiumSourceLimitExceeded(object_ptr<PremiumLimitType> &&limit_type_)
  : limit_type_(std::move(limit_type_))
{}

const std::int32_t premiumSourceLimitExceeded::ID;

object_ptr<PremiumSource> premiumSourceLimitExceeded::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumSourceLimitExceeded> res = make_object<premiumSourceLimitExceeded>();
  res->limit_type_ = jni::fetch_tl_object<PremiumLimitType>(env, jni::fetch_object(env, p, res->limit_type_fieldID));
  return std::move(res);
}

void premiumSourceLimitExceeded::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumSourceLimitExceeded");
    s.store_object_field("limitType", static_cast<const BaseObject *>(limit_type_.get()));
    s.store_class_end();
  }
}

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

jclass premiumSourceFeature::Class;
jfieldID premiumSourceFeature::feature_fieldID;

premiumSourceFeature::premiumSourceFeature()
  : feature_()
{}

premiumSourceFeature::premiumSourceFeature(object_ptr<PremiumFeature> &&feature_)
  : feature_(std::move(feature_))
{}

const std::int32_t premiumSourceFeature::ID;

object_ptr<PremiumSource> premiumSourceFeature::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumSourceFeature> res = make_object<premiumSourceFeature>();
  res->feature_ = jni::fetch_tl_object<PremiumFeature>(env, jni::fetch_object(env, p, res->feature_fieldID));
  return std::move(res);
}

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

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

jclass premiumSourceBusinessFeature::Class;
jfieldID premiumSourceBusinessFeature::feature_fieldID;

premiumSourceBusinessFeature::premiumSourceBusinessFeature()
  : feature_()
{}

premiumSourceBusinessFeature::premiumSourceBusinessFeature(object_ptr<BusinessFeature> &&feature_)
  : feature_(std::move(feature_))
{}

const std::int32_t premiumSourceBusinessFeature::ID;

object_ptr<PremiumSource> premiumSourceBusinessFeature::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumSourceBusinessFeature> res = make_object<premiumSourceBusinessFeature>();
  res->feature_ = jni::fetch_tl_object<BusinessFeature>(env, jni::fetch_object(env, p, res->feature_fieldID));
  return std::move(res);
}

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

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

jclass premiumSourceStoryFeature::Class;
jfieldID premiumSourceStoryFeature::feature_fieldID;

premiumSourceStoryFeature::premiumSourceStoryFeature()
  : feature_()
{}

premiumSourceStoryFeature::premiumSourceStoryFeature(object_ptr<PremiumStoryFeature> &&feature_)
  : feature_(std::move(feature_))
{}

const std::int32_t premiumSourceStoryFeature::ID;

object_ptr<PremiumSource> premiumSourceStoryFeature::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumSourceStoryFeature> res = make_object<premiumSourceStoryFeature>();
  res->feature_ = jni::fetch_tl_object<PremiumStoryFeature>(env, jni::fetch_object(env, p, res->feature_fieldID));
  return std::move(res);
}

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

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

jclass premiumSourceLink::Class;
jfieldID premiumSourceLink::referrer_fieldID;

premiumSourceLink::premiumSourceLink()
  : referrer_()
{}

premiumSourceLink::premiumSourceLink(string const &referrer_)
  : referrer_(referrer_)
{}

const std::int32_t premiumSourceLink::ID;

object_ptr<PremiumSource> premiumSourceLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<premiumSourceLink> res = make_object<premiumSourceLink>();
  res->referrer_ = jni::fetch_string(env, p, res->referrer_fieldID);
  return std::move(res);
}

void premiumSourceLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PremiumSourceLink");
    s.store_field("referrer", referrer_);
    s.store_class_end();
  }
}

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

jclass premiumSourceSettings::Class;

premiumSourceSettings::premiumSourceSettings() {
}

const std::int32_t premiumSourceSettings::ID;

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

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

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

jclass profileAccentColor::Class;
jfieldID profileAccentColor::id_fieldID;
jfieldID profileAccentColor::light_theme_colors_fieldID;
jfieldID profileAccentColor::dark_theme_colors_fieldID;
jfieldID profileAccentColor::min_supergroup_chat_boost_level_fieldID;
jfieldID profileAccentColor::min_channel_chat_boost_level_fieldID;

profileAccentColor::profileAccentColor()
  : id_()
  , light_theme_colors_()
  , dark_theme_colors_()
  , min_supergroup_chat_boost_level_()
  , min_channel_chat_boost_level_()
{}

profileAccentColor::profileAccentColor(int32 id_, object_ptr<profileAccentColors> &&light_theme_colors_, object_ptr<profileAccentColors> &&dark_theme_colors_, int32 min_supergroup_chat_boost_level_, int32 min_channel_chat_boost_level_)
  : id_(id_)
  , light_theme_colors_(std::move(light_theme_colors_))
  , dark_theme_colors_(std::move(dark_theme_colors_))
  , min_supergroup_chat_boost_level_(min_supergroup_chat_boost_level_)
  , min_channel_chat_boost_level_(min_channel_chat_boost_level_)
{}

const std::int32_t profileAccentColor::ID;

object_ptr<profileAccentColor> profileAccentColor::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<profileAccentColor> res = make_object<profileAccentColor>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->light_theme_colors_ = jni::fetch_tl_object<profileAccentColors>(env, jni::fetch_object(env, p, res->light_theme_colors_fieldID));
  res->dark_theme_colors_ = jni::fetch_tl_object<profileAccentColors>(env, jni::fetch_object(env, p, res->dark_theme_colors_fieldID));
  res->min_supergroup_chat_boost_level_ = env->GetIntField(p, res->min_supergroup_chat_boost_level_fieldID);
  res->min_channel_chat_boost_level_ = env->GetIntField(p, res->min_channel_chat_boost_level_fieldID);
  return res;
}

void profileAccentColor::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetIntField(s, id_fieldID, id_);
  if (light_theme_colors_ != nullptr) { jobject next; light_theme_colors_->store(env, next); if (next) { env->SetObjectField(s, light_theme_colors_fieldID, next); env->DeleteLocalRef(next); } }
  if (dark_theme_colors_ != nullptr) { jobject next; dark_theme_colors_->store(env, next); if (next) { env->SetObjectField(s, dark_theme_colors_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, min_supergroup_chat_boost_level_fieldID, min_supergroup_chat_boost_level_);
  env->SetIntField(s, min_channel_chat_boost_level_fieldID, min_channel_chat_boost_level_);
}

void profileAccentColor::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ProfileAccentColor");
    s.store_field("id", id_);
    s.store_object_field("lightThemeColors", static_cast<const BaseObject *>(light_theme_colors_.get()));
    s.store_object_field("darkThemeColors", static_cast<const BaseObject *>(dark_theme_colors_.get()));
    s.store_field("minSupergroupChatBoostLevel", min_supergroup_chat_boost_level_);
    s.store_field("minChannelChatBoostLevel", min_channel_chat_boost_level_);
    s.store_class_end();
  }
}

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

jclass proxy::Class;
jfieldID proxy::server_fieldID;
jfieldID proxy::port_fieldID;
jfieldID proxy::type_fieldID;

proxy::proxy()
  : server_()
  , port_()
  , type_()
{}

proxy::proxy(string const &server_, int32 port_, object_ptr<ProxyType> &&type_)
  : server_(server_)
  , port_(port_)
  , type_(std::move(type_))
{}

const std::int32_t proxy::ID;

object_ptr<proxy> proxy::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<proxy> res = make_object<proxy>();
  res->server_ = jni::fetch_string(env, p, res->server_fieldID);
  res->port_ = env->GetIntField(p, res->port_fieldID);
  res->type_ = jni::fetch_tl_object<ProxyType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

void proxy::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, server_); if (nextString) { env->SetObjectField(s, server_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, port_fieldID, port_);
  if (type_ != nullptr) { jobject next; type_->store(env, next); if (next) { env->SetObjectField(s, type_fieldID, next); env->DeleteLocalRef(next); } }
}

void proxy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Proxy");
    s.store_field("server", server_);
    s.store_field("port", port_);
    s.store_object_field("type", static_cast<const BaseObject *>(type_.get()));
    s.store_class_end();
  }
}

void proxy::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Proxy").c_str());
    server_fieldID = jni::get_field_id(env, Class, "server", "Ljava/lang/String;");
    port_fieldID = jni::get_field_id(env, Class, "port", "I");
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ProxyType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass PublicChatType::Class;

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

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

jclass publicChatTypeHasUsername::Class;

publicChatTypeHasUsername::publicChatTypeHasUsername() {
}

const std::int32_t publicChatTypeHasUsername::ID;

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

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

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

jclass publicChatTypeIsLocationBased::Class;

publicChatTypeIsLocationBased::publicChatTypeIsLocationBased() {
}

const std::int32_t publicChatTypeIsLocationBased::ID;

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

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

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

jclass pushReceiverId::Class;
jfieldID pushReceiverId::id_fieldID;

pushReceiverId::pushReceiverId()
  : id_()
{}

pushReceiverId::pushReceiverId(int64 id_)
  : id_(id_)
{}

const std::int32_t pushReceiverId::ID;

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

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

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

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

jclass receivedGift::Class;
jfieldID receivedGift::received_gift_id_fieldID;
jfieldID receivedGift::sender_id_fieldID;
jfieldID receivedGift::text_fieldID;
jfieldID receivedGift::unique_gift_number_fieldID;
jfieldID receivedGift::is_private_fieldID;
jfieldID receivedGift::is_saved_fieldID;
jfieldID receivedGift::is_pinned_fieldID;
jfieldID receivedGift::can_be_upgraded_fieldID;
jfieldID receivedGift::can_be_transferred_fieldID;
jfieldID receivedGift::was_refunded_fieldID;
jfieldID receivedGift::date_fieldID;
jfieldID receivedGift::gift_fieldID;
jfieldID receivedGift::collection_ids_fieldID;
jfieldID receivedGift::sell_star_count_fieldID;
jfieldID receivedGift::prepaid_upgrade_star_count_fieldID;
jfieldID receivedGift::is_upgrade_separate_fieldID;
jfieldID receivedGift::transfer_star_count_fieldID;
jfieldID receivedGift::drop_original_details_star_count_fieldID;
jfieldID receivedGift::next_transfer_date_fieldID;
jfieldID receivedGift::next_resale_date_fieldID;
jfieldID receivedGift::export_date_fieldID;
jfieldID receivedGift::prepaid_upgrade_hash_fieldID;
jfieldID receivedGift::craft_date_fieldID;

receivedGift::receivedGift()
  : received_gift_id_()
  , sender_id_()
  , text_()
  , unique_gift_number_()
  , is_private_()
  , is_saved_()
  , is_pinned_()
  , can_be_upgraded_()
  , can_be_transferred_()
  , was_refunded_()
  , date_()
  , gift_()
  , collection_ids_()
  , sell_star_count_()
  , prepaid_upgrade_star_count_()
  , is_upgrade_separate_()
  , transfer_star_count_()
  , drop_original_details_star_count_()
  , next_transfer_date_()
  , next_resale_date_()
  , export_date_()
  , prepaid_upgrade_hash_()
  , craft_date_()
{}

receivedGift::receivedGift(string const &received_gift_id_, object_ptr<MessageSender> &&sender_id_, object_ptr<formattedText> &&text_, int32 unique_gift_number_, bool is_private_, bool is_saved_, bool is_pinned_, bool can_be_upgraded_, bool can_be_transferred_, bool was_refunded_, int32 date_, object_ptr<SentGift> &&gift_, array<int32> &&collection_ids_, int53 sell_star_count_, int53 prepaid_upgrade_star_count_, bool is_upgrade_separate_, int53 transfer_star_count_, int53 drop_original_details_star_count_, int32 next_transfer_date_, int32 next_resale_date_, int32 export_date_, string const &prepaid_upgrade_hash_, int32 craft_date_)
  : received_gift_id_(received_gift_id_)
  , sender_id_(std::move(sender_id_))
  , text_(std::move(text_))
  , unique_gift_number_(unique_gift_number_)
  , is_private_(is_private_)
  , is_saved_(is_saved_)
  , is_pinned_(is_pinned_)
  , can_be_upgraded_(can_be_upgraded_)
  , can_be_transferred_(can_be_transferred_)
  , was_refunded_(was_refunded_)
  , date_(date_)
  , gift_(std::move(gift_))
  , collection_ids_(std::move(collection_ids_))
  , sell_star_count_(sell_star_count_)
  , prepaid_upgrade_star_count_(prepaid_upgrade_star_count_)
  , is_upgrade_separate_(is_upgrade_separate_)
  , transfer_star_count_(transfer_star_count_)
  , drop_original_details_star_count_(drop_original_details_star_count_)
  , next_transfer_date_(next_transfer_date_)
  , next_resale_date_(next_resale_date_)
  , export_date_(export_date_)
  , prepaid_upgrade_hash_(prepaid_upgrade_hash_)
  , craft_date_(craft_date_)
{}

const std::int32_t receivedGift::ID;

object_ptr<receivedGift> receivedGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<receivedGift> res = make_object<receivedGift>();
  res->received_gift_id_ = jni::fetch_string(env, p, res->received_gift_id_fieldID);
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->unique_gift_number_ = env->GetIntField(p, res->unique_gift_number_fieldID);
  res->is_private_ = (env->GetBooleanField(p, res->is_private_fieldID) != 0);
  res->is_saved_ = (env->GetBooleanField(p, res->is_saved_fieldID) != 0);
  res->is_pinned_ = (env->GetBooleanField(p, res->is_pinned_fieldID) != 0);
  res->can_be_upgraded_ = (env->GetBooleanField(p, res->can_be_upgraded_fieldID) != 0);
  res->can_be_transferred_ = (env->GetBooleanField(p, res->can_be_transferred_fieldID) != 0);
  res->was_refunded_ = (env->GetBooleanField(p, res->was_refunded_fieldID) != 0);
  res->date_ = env->GetIntField(p, res->date_fieldID);
  res->gift_ = jni::fetch_tl_object<SentGift>(env, jni::fetch_object(env, p, res->gift_fieldID));
  res->collection_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->collection_ids_fieldID));
  res->sell_star_count_ = env->GetLongField(p, res->sell_star_count_fieldID);
  res->prepaid_upgrade_star_count_ = env->GetLongField(p, res->prepaid_upgrade_star_count_fieldID);
  res->is_upgrade_separate_ = (env->GetBooleanField(p, res->is_upgrade_separate_fieldID) != 0);
  res->transfer_star_count_ = env->GetLongField(p, res->transfer_star_count_fieldID);
  res->drop_original_details_star_count_ = env->GetLongField(p, res->drop_original_details_star_count_fieldID);
  res->next_transfer_date_ = env->GetIntField(p, res->next_transfer_date_fieldID);
  res->next_resale_date_ = env->GetIntField(p, res->next_resale_date_fieldID);
  res->export_date_ = env->GetIntField(p, res->export_date_fieldID);
  res->prepaid_upgrade_hash_ = jni::fetch_string(env, p, res->prepaid_upgrade_hash_fieldID);
  res->craft_date_ = env->GetIntField(p, res->craft_date_fieldID);
  return res;
}

void receivedGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, received_gift_id_); if (nextString) { env->SetObjectField(s, received_gift_id_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (sender_id_ != nullptr) { jobject next; sender_id_->store(env, next); if (next) { env->SetObjectField(s, sender_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (text_ != nullptr) { jobject next; text_->store(env, next); if (next) { env->SetObjectField(s, text_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, unique_gift_number_fieldID, unique_gift_number_);
  env->SetBooleanField(s, is_private_fieldID, is_private_);
  env->SetBooleanField(s, is_saved_fieldID, is_saved_);
  env->SetBooleanField(s, is_pinned_fieldID, is_pinned_);
  env->SetBooleanField(s, can_be_upgraded_fieldID, can_be_upgraded_);
  env->SetBooleanField(s, can_be_transferred_fieldID, can_be_transferred_);
  env->SetBooleanField(s, was_refunded_fieldID, was_refunded_);
  env->SetIntField(s, date_fieldID, date_);
  if (gift_ != nullptr) { jobject next; gift_->store(env, next); if (next) { env->SetObjectField(s, gift_fieldID, next); env->DeleteLocalRef(next); } }
  { auto arr_tmp_ = jni::store_vector(env, collection_ids_); if (arr_tmp_) { env->SetObjectField(s, collection_ids_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetLongField(s, sell_star_count_fieldID, sell_star_count_);
  env->SetLongField(s, prepaid_upgrade_star_count_fieldID, prepaid_upgrade_star_count_);
  env->SetBooleanField(s, is_upgrade_separate_fieldID, is_upgrade_separate_);
  env->SetLongField(s, transfer_star_count_fieldID, transfer_star_count_);
  env->SetLongField(s, drop_original_details_star_count_fieldID, drop_original_details_star_count_);
  env->SetIntField(s, next_transfer_date_fieldID, next_transfer_date_);
  env->SetIntField(s, next_resale_date_fieldID, next_resale_date_);
  env->SetIntField(s, export_date_fieldID, export_date_);
  { jstring nextString = jni::to_jstring(env, prepaid_upgrade_hash_); if (nextString) { env->SetObjectField(s, prepaid_upgrade_hash_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, craft_date_fieldID, craft_date_);
}

void receivedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReceivedGift");
    s.store_field("receivedGiftId", received_gift_id_);
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_field("uniqueGiftNumber", unique_gift_number_);
    s.store_field("isPrivate", is_private_);
    s.store_field("isSaved", is_saved_);
    s.store_field("isPinned", is_pinned_);
    s.store_field("canBeUpgraded", can_be_upgraded_);
    s.store_field("canBeTransferred", can_be_transferred_);
    s.store_field("wasRefunded", was_refunded_);
    s.store_field("date", date_);
    s.store_object_field("gift", static_cast<const BaseObject *>(gift_.get()));
    { s.store_vector_begin("collectionIds", collection_ids_.size()); for (const auto &_value : collection_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("sellStarCount", sell_star_count_);
    s.store_field("prepaidUpgradeStarCount", prepaid_upgrade_star_count_);
    s.store_field("isUpgradeSeparate", is_upgrade_separate_);
    s.store_field("transferStarCount", transfer_star_count_);
    s.store_field("dropOriginalDetailsStarCount", drop_original_details_star_count_);
    s.store_field("nextTransferDate", next_transfer_date_);
    s.store_field("nextResaleDate", next_resale_date_);
    s.store_field("exportDate", export_date_);
    s.store_field("prepaidUpgradeHash", prepaid_upgrade_hash_);
    s.store_field("craftDate", craft_date_);
    s.store_class_end();
  }
}

void receivedGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReceivedGift").c_str());
    received_gift_id_fieldID = jni::get_field_id(env, Class, "receivedGiftId", "Ljava/lang/String;");
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    unique_gift_number_fieldID = jni::get_field_id(env, Class, "uniqueGiftNumber", "I");
    is_private_fieldID = jni::get_field_id(env, Class, "isPrivate", "Z");
    is_saved_fieldID = jni::get_field_id(env, Class, "isSaved", "Z");
    is_pinned_fieldID = jni::get_field_id(env, Class, "isPinned", "Z");
    can_be_upgraded_fieldID = jni::get_field_id(env, Class, "canBeUpgraded", "Z");
    can_be_transferred_fieldID = jni::get_field_id(env, Class, "canBeTransferred", "Z");
    was_refunded_fieldID = jni::get_field_id(env, Class, "wasRefunded", "Z");
    date_fieldID = jni::get_field_id(env, Class, "date", "I");
    gift_fieldID = jni::get_field_id(env, Class, "gift", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SentGift;").c_str());
    collection_ids_fieldID = jni::get_field_id(env, Class, "collectionIds", "[I");
    sell_star_count_fieldID = jni::get_field_id(env, Class, "sellStarCount", "J");
    prepaid_upgrade_star_count_fieldID = jni::get_field_id(env, Class, "prepaidUpgradeStarCount", "J");
    is_upgrade_separate_fieldID = jni::get_field_id(env, Class, "isUpgradeSeparate", "Z");
    transfer_star_count_fieldID = jni::get_field_id(env, Class, "transferStarCount", "J");
    drop_original_details_star_count_fieldID = jni::get_field_id(env, Class, "dropOriginalDetailsStarCount", "J");
    next_transfer_date_fieldID = jni::get_field_id(env, Class, "nextTransferDate", "I");
    next_resale_date_fieldID = jni::get_field_id(env, Class, "nextResaleDate", "I");
    export_date_fieldID = jni::get_field_id(env, Class, "exportDate", "I");
    prepaid_upgrade_hash_fieldID = jni::get_field_id(env, Class, "prepaidUpgradeHash", "Ljava/lang/String;");
    craft_date_fieldID = jni::get_field_id(env, Class, "craftDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass seconds::Class;
jfieldID seconds::seconds_fieldID;

seconds::seconds()
  : seconds_()
{}

seconds::seconds(double seconds_)
  : seconds_(seconds_)
{}

const std::int32_t seconds::ID;

object_ptr<seconds> seconds::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<seconds> res = make_object<seconds>();
  res->seconds_ = env->GetDoubleField(p, res->seconds_fieldID);
  return res;
}

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

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

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

jclass SecretChatState::Class;

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

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

jclass secretChatStatePending::Class;

secretChatStatePending::secretChatStatePending() {
}

const std::int32_t secretChatStatePending::ID;

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

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

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

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

jclass secretChatStateReady::Class;

secretChatStateReady::secretChatStateReady() {
}

const std::int32_t secretChatStateReady::ID;

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

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

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

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

jclass secretChatStateClosed::Class;

secretChatStateClosed::secretChatStateClosed() {
}

const std::int32_t secretChatStateClosed::ID;

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

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

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

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

jclass SentGift::Class;

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

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

jclass sentGiftRegular::Class;
jfieldID sentGiftRegular::gift_fieldID;

sentGiftRegular::sentGiftRegular()
  : gift_()
{}

sentGiftRegular::sentGiftRegular(object_ptr<gift> &&gift_)
  : gift_(std::move(gift_))
{}

const std::int32_t sentGiftRegular::ID;

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

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

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

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

jclass sentGiftUpgraded::Class;
jfieldID sentGiftUpgraded::gift_fieldID;

sentGiftUpgraded::sentGiftUpgraded()
  : gift_()
{}

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

const std::int32_t sentGiftUpgraded::ID;

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

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

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

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

jclass SessionType::Class;

object_ptr<SessionType> SessionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) { return nullptr; }
  jint constructor = env->CallIntMethod(p, jni::GetConstructorID);  switch (constructor) {
    case sessionTypeAndroid::ID:
      return sessionTypeAndroid::fetch(env, p);
    case sessionTypeApple::ID:
      return sessionTypeApple::fetch(env, p);
    case sessionTypeBrave::ID:
      return sessionTypeBrave::fetch(env, p);
    case sessionTypeChrome::ID:
      return sessionTypeChrome::fetch(env, p);
    case sessionTypeEdge::ID:
      return sessionTypeEdge::fetch(env, p);
    case sessionTypeFirefox::ID:
      return sessionTypeFirefox::fetch(env, p);
    case sessionTypeIpad::ID:
      return sessionTypeIpad::fetch(env, p);
    case sessionTypeIphone::ID:
      return sessionTypeIphone::fetch(env, p);
    case sessionTypeLinux::ID:
      return sessionTypeLinux::fetch(env, p);
    case sessionTypeMac::ID:
      return sessionTypeMac::fetch(env, p);
    case sessionTypeOpera::ID:
      return sessionTypeOpera::fetch(env, p);
    case sessionTypeSafari::ID:
      return sessionTypeSafari::fetch(env, p);
    case sessionTypeUbuntu::ID:
      return sessionTypeUbuntu::fetch(env, p);
    case sessionTypeUnknown::ID:
      return sessionTypeUnknown::fetch(env, p);
    case sessionTypeVivaldi::ID:
      return sessionTypeVivaldi::fetch(env, p);
    case sessionTypeWindows::ID:
      return sessionTypeWindows::fetch(env, p);
    case sessionTypeXbox::ID:
      return sessionTypeXbox::fetch(env, p);
    default:
      LOG(WARNING) << "Unknown Java API constructor found " << format::as_hex(constructor);
      return nullptr;
  }
}

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

jclass sessionTypeAndroid::Class;

sessionTypeAndroid::sessionTypeAndroid() {
}

const std::int32_t sessionTypeAndroid::ID;

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

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

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

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

jclass sessionTypeApple::Class;

sessionTypeApple::sessionTypeApple() {
}

const std::int32_t sessionTypeApple::ID;

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

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

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

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

jclass sessionTypeBrave::Class;

sessionTypeBrave::sessionTypeBrave() {
}

const std::int32_t sessionTypeBrave::ID;

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

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

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

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

jclass sessionTypeChrome::Class;

sessionTypeChrome::sessionTypeChrome() {
}

const std::int32_t sessionTypeChrome::ID;

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

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

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

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

jclass sessionTypeEdge::Class;

sessionTypeEdge::sessionTypeEdge() {
}

const std::int32_t sessionTypeEdge::ID;

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

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

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

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

jclass sessionTypeFirefox::Class;

sessionTypeFirefox::sessionTypeFirefox() {
}

const std::int32_t sessionTypeFirefox::ID;

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

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

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

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

jclass sessionTypeIpad::Class;

sessionTypeIpad::sessionTypeIpad() {
}

const std::int32_t sessionTypeIpad::ID;

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

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

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

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

jclass sessionTypeIphone::Class;

sessionTypeIphone::sessionTypeIphone() {
}

const std::int32_t sessionTypeIphone::ID;

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

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

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

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

jclass sessionTypeLinux::Class;

sessionTypeLinux::sessionTypeLinux() {
}

const std::int32_t sessionTypeLinux::ID;

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

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

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

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

jclass sessionTypeMac::Class;

sessionTypeMac::sessionTypeMac() {
}

const std::int32_t sessionTypeMac::ID;

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

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

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

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

jclass sessionTypeOpera::Class;

sessionTypeOpera::sessionTypeOpera() {
}

const std::int32_t sessionTypeOpera::ID;

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

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

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

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

jclass sessionTypeSafari::Class;

sessionTypeSafari::sessionTypeSafari() {
}

const std::int32_t sessionTypeSafari::ID;

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

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

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

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

jclass sessionTypeUbuntu::Class;

sessionTypeUbuntu::sessionTypeUbuntu() {
}

const std::int32_t sessionTypeUbuntu::ID;

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

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

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

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

jclass sessionTypeUnknown::Class;

sessionTypeUnknown::sessionTypeUnknown() {
}

const std::int32_t sessionTypeUnknown::ID;

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

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

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

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

jclass sessionTypeVivaldi::Class;

sessionTypeVivaldi::sessionTypeVivaldi() {
}

const std::int32_t sessionTypeVivaldi::ID;

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

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

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

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

jclass sessionTypeWindows::Class;

sessionTypeWindows::sessionTypeWindows() {
}

const std::int32_t sessionTypeWindows::ID;

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

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

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

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

jclass sessionTypeXbox::Class;

sessionTypeXbox::sessionTypeXbox() {
}

const std::int32_t sessionTypeXbox::ID;

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

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

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

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

jclass sessions::Class;
jfieldID sessions::sessions_fieldID;
jfieldID sessions::inactive_session_ttl_days_fieldID;

sessions::sessions()
  : sessions_()
  , inactive_session_ttl_days_()
{}

sessions::sessions(array<object_ptr<session>> &&sessions_, int32 inactive_session_ttl_days_)
  : sessions_(std::move(sessions_))
  , inactive_session_ttl_days_(inactive_session_ttl_days_)
{}

const std::int32_t sessions::ID;

object_ptr<sessions> sessions::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sessions> res = make_object<sessions>();
  res->sessions_ = jni::FetchVector<session>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->sessions_fieldID));
  res->inactive_session_ttl_days_ = env->GetIntField(p, res->inactive_session_ttl_days_fieldID);
  return res;
}

void sessions::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { auto arr_tmp_ = jni::store_vector(env, sessions_); if (arr_tmp_) { env->SetObjectField(s, sessions_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, inactive_session_ttl_days_fieldID, inactive_session_ttl_days_);
}

void sessions::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Sessions");
    { s.store_vector_begin("sessions", sessions_.size()); for (const auto &_value : sessions_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("inactiveSessionTtlDays", inactive_session_ttl_days_);
    s.store_class_end();
  }
}

void sessions::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Sessions").c_str());
    sessions_fieldID = jni::get_field_id(env, Class, "sessions", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$Session;").c_str());
    inactive_session_ttl_days_fieldID = jni::get_field_id(env, Class, "inactiveSessionTtlDays", "I");
    return true;
  }();
  (void)is_inited;
}

jclass stakeDiceState::Class;
jfieldID stakeDiceState::state_hash_fieldID;
jfieldID stakeDiceState::stake_toncoin_amount_fieldID;
jfieldID stakeDiceState::suggested_stake_toncoin_amounts_fieldID;
jfieldID stakeDiceState::current_streak_fieldID;
jfieldID stakeDiceState::prize_per_mille_fieldID;
jfieldID stakeDiceState::streak_prize_per_mille_fieldID;

stakeDiceState::stakeDiceState()
  : state_hash_()
  , stake_toncoin_amount_()
  , suggested_stake_toncoin_amounts_()
  , current_streak_()
  , prize_per_mille_()
  , streak_prize_per_mille_()
{}

stakeDiceState::stakeDiceState(string const &state_hash_, int53 stake_toncoin_amount_, array<int53> &&suggested_stake_toncoin_amounts_, int32 current_streak_, array<int32> &&prize_per_mille_, int32 streak_prize_per_mille_)
  : state_hash_(state_hash_)
  , stake_toncoin_amount_(stake_toncoin_amount_)
  , suggested_stake_toncoin_amounts_(std::move(suggested_stake_toncoin_amounts_))
  , current_streak_(current_streak_)
  , prize_per_mille_(std::move(prize_per_mille_))
  , streak_prize_per_mille_(streak_prize_per_mille_)
{}

const std::int32_t stakeDiceState::ID;

object_ptr<stakeDiceState> stakeDiceState::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<stakeDiceState> res = make_object<stakeDiceState>();
  res->state_hash_ = jni::fetch_string(env, p, res->state_hash_fieldID);
  res->stake_toncoin_amount_ = env->GetLongField(p, res->stake_toncoin_amount_fieldID);
  res->suggested_stake_toncoin_amounts_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->suggested_stake_toncoin_amounts_fieldID));
  res->current_streak_ = env->GetIntField(p, res->current_streak_fieldID);
  res->prize_per_mille_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->prize_per_mille_fieldID));
  res->streak_prize_per_mille_ = env->GetIntField(p, res->streak_prize_per_mille_fieldID);
  return res;
}

void stakeDiceState::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  { jstring nextString = jni::to_jstring(env, state_hash_); if (nextString) { env->SetObjectField(s, state_hash_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, stake_toncoin_amount_fieldID, stake_toncoin_amount_);
  { auto arr_tmp_ = jni::store_vector(env, suggested_stake_toncoin_amounts_); if (arr_tmp_) { env->SetObjectField(s, suggested_stake_toncoin_amounts_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, current_streak_fieldID, current_streak_);
  { auto arr_tmp_ = jni::store_vector(env, prize_per_mille_); if (arr_tmp_) { env->SetObjectField(s, prize_per_mille_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, streak_prize_per_mille_fieldID, streak_prize_per_mille_);
}

void stakeDiceState::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StakeDiceState");
    s.store_field("stateHash", state_hash_);
    s.store_field("stakeToncoinAmount", stake_toncoin_amount_);
    { s.store_vector_begin("suggestedStakeToncoinAmounts", suggested_stake_toncoin_amounts_.size()); for (const auto &_value : suggested_stake_toncoin_amounts_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("currentStreak", current_streak_);
    { s.store_vector_begin("prizePerMille", prize_per_mille_.size()); for (const auto &_value : prize_per_mille_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("streakPrizePerMille", streak_prize_per_mille_);
    s.store_class_end();
  }
}

void stakeDiceState::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StakeDiceState").c_str());
    state_hash_fieldID = jni::get_field_id(env, Class, "stateHash", "Ljava/lang/String;");
    stake_toncoin_amount_fieldID = jni::get_field_id(env, Class, "stakeToncoinAmount", "J");
    suggested_stake_toncoin_amounts_fieldID = jni::get_field_id(env, Class, "suggestedStakeToncoinAmounts", "[J");
    current_streak_fieldID = jni::get_field_id(env, Class, "currentStreak", "I");
    prize_per_mille_fieldID = jni::get_field_id(env, Class, "prizePerMille", "[I");
    streak_prize_per_mille_fieldID = jni::get_field_id(env, Class, "streakPrizePerMille", "I");
    return true;
  }();
  (void)is_inited;
}

jclass starCount::Class;
jfieldID starCount::star_count_fieldID;

starCount::starCount()
  : star_count_()
{}

starCount::starCount(int53 star_count_)
  : star_count_(star_count_)
{}

const std::int32_t starCount::ID;

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

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

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

jclass sticker::Class;
jfieldID sticker::id_fieldID;
jfieldID sticker::set_id_fieldID;
jfieldID sticker::width_fieldID;
jfieldID sticker::height_fieldID;
jfieldID sticker::emoji_fieldID;
jfieldID sticker::format_fieldID;
jfieldID sticker::full_type_fieldID;
jfieldID sticker::thumbnail_fieldID;
jfieldID sticker::sticker_fieldID;

sticker::sticker()
  : id_()
  , set_id_()
  , width_()
  , height_()
  , emoji_()
  , format_()
  , full_type_()
  , thumbnail_()
  , sticker_()
{}

sticker::sticker(int64 id_, int64 set_id_, int32 width_, int32 height_, string const &emoji_, object_ptr<StickerFormat> &&format_, object_ptr<StickerFullType> &&full_type_, object_ptr<thumbnail> &&thumbnail_, object_ptr<file> &&sticker_)
  : id_(id_)
  , set_id_(set_id_)
  , width_(width_)
  , height_(height_)
  , emoji_(emoji_)
  , format_(std::move(format_))
  , full_type_(std::move(full_type_))
  , thumbnail_(std::move(thumbnail_))
  , sticker_(std::move(sticker_))
{}

const std::int32_t sticker::ID;

object_ptr<sticker> sticker::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<sticker> res = make_object<sticker>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->set_id_ = env->GetLongField(p, res->set_id_fieldID);
  res->width_ = env->GetIntField(p, res->width_fieldID);
  res->height_ = env->GetIntField(p, res->height_fieldID);
  res->emoji_ = jni::fetch_string(env, p, res->emoji_fieldID);
  res->format_ = jni::fetch_tl_object<StickerFormat>(env, jni::fetch_object(env, p, res->format_fieldID));
  res->full_type_ = jni::fetch_tl_object<StickerFullType>(env, jni::fetch_object(env, p, res->full_type_fieldID));
  res->thumbnail_ = jni::fetch_tl_object<thumbnail>(env, jni::fetch_object(env, p, res->thumbnail_fieldID));
  res->sticker_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  return res;
}

void sticker::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, set_id_fieldID, set_id_);
  env->SetIntField(s, width_fieldID, width_);
  env->SetIntField(s, height_fieldID, height_);
  { jstring nextString = jni::to_jstring(env, emoji_); if (nextString) { env->SetObjectField(s, emoji_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (format_ != nullptr) { jobject next; format_->store(env, next); if (next) { env->SetObjectField(s, format_fieldID, next); env->DeleteLocalRef(next); } }
  if (full_type_ != nullptr) { jobject next; full_type_->store(env, next); if (next) { env->SetObjectField(s, full_type_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 (sticker_ != nullptr) { jobject next; sticker_->store(env, next); if (next) { env->SetObjectField(s, sticker_fieldID, next); env->DeleteLocalRef(next); } }
}

void sticker::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "Sticker");
    s.store_field("id", id_);
    s.store_field("setId", set_id_);
    s.store_field("width", width_);
    s.store_field("height", height_);
    s.store_field("emoji", emoji_);
    s.store_object_field("format", static_cast<const BaseObject *>(format_.get()));
    s.store_object_field("fullType", static_cast<const BaseObject *>(full_type_.get()));
    s.store_object_field("thumbnail", static_cast<const BaseObject *>(thumbnail_.get()));
    s.store_object_field("sticker", static_cast<const BaseObject *>(sticker_.get()));
    s.store_class_end();
  }
}

void sticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$Sticker").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    set_id_fieldID = jni::get_field_id(env, Class, "setId", "J");
    width_fieldID = jni::get_field_id(env, Class, "width", "I");
    height_fieldID = jni::get_field_id(env, Class, "height", "I");
    emoji_fieldID = jni::get_field_id(env, Class, "emoji", "Ljava/lang/String;");
    format_fieldID = jni::get_field_id(env, Class, "format", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerFormat;").c_str());
    full_type_fieldID = jni::get_field_id(env, Class, "fullType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerFullType;").c_str());
    thumbnail_fieldID = jni::get_field_id(env, Class, "thumbnail", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Thumbnail;").c_str());
    sticker_fieldID = jni::get_field_id(env, Class, "sticker", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storageStatisticsFast::Class;
jfieldID storageStatisticsFast::files_size_fieldID;
jfieldID storageStatisticsFast::file_count_fieldID;
jfieldID storageStatisticsFast::database_size_fieldID;
jfieldID storageStatisticsFast::language_pack_database_size_fieldID;
jfieldID storageStatisticsFast::log_size_fieldID;

storageStatisticsFast::storageStatisticsFast()
  : files_size_()
  , file_count_()
  , database_size_()
  , language_pack_database_size_()
  , log_size_()
{}

storageStatisticsFast::storageStatisticsFast(int53 files_size_, int32 file_count_, int53 database_size_, int53 language_pack_database_size_, int53 log_size_)
  : files_size_(files_size_)
  , file_count_(file_count_)
  , database_size_(database_size_)
  , language_pack_database_size_(language_pack_database_size_)
  , log_size_(log_size_)
{}

const std::int32_t storageStatisticsFast::ID;

object_ptr<storageStatisticsFast> storageStatisticsFast::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storageStatisticsFast> res = make_object<storageStatisticsFast>();
  res->files_size_ = env->GetLongField(p, res->files_size_fieldID);
  res->file_count_ = env->GetIntField(p, res->file_count_fieldID);
  res->database_size_ = env->GetLongField(p, res->database_size_fieldID);
  res->language_pack_database_size_ = env->GetLongField(p, res->language_pack_database_size_fieldID);
  res->log_size_ = env->GetLongField(p, res->log_size_fieldID);
  return res;
}

void storageStatisticsFast::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, files_size_fieldID, files_size_);
  env->SetIntField(s, file_count_fieldID, file_count_);
  env->SetLongField(s, database_size_fieldID, database_size_);
  env->SetLongField(s, language_pack_database_size_fieldID, language_pack_database_size_);
  env->SetLongField(s, log_size_fieldID, log_size_);
}

void storageStatisticsFast::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StorageStatisticsFast");
    s.store_field("filesSize", files_size_);
    s.store_field("fileCount", file_count_);
    s.store_field("databaseSize", database_size_);
    s.store_field("languagePackDatabaseSize", language_pack_database_size_);
    s.store_field("logSize", log_size_);
    s.store_class_end();
  }
}

void storageStatisticsFast::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StorageStatisticsFast").c_str());
    files_size_fieldID = jni::get_field_id(env, Class, "filesSize", "J");
    file_count_fieldID = jni::get_field_id(env, Class, "fileCount", "I");
    database_size_fieldID = jni::get_field_id(env, Class, "databaseSize", "J");
    language_pack_database_size_fieldID = jni::get_field_id(env, Class, "languagePackDatabaseSize", "J");
    log_size_fieldID = jni::get_field_id(env, Class, "logSize", "J");
    return true;
  }();
  (void)is_inited;
}

jclass storyAlbum::Class;
jfieldID storyAlbum::id_fieldID;
jfieldID storyAlbum::name_fieldID;
jfieldID storyAlbum::photo_icon_fieldID;
jfieldID storyAlbum::video_icon_fieldID;

storyAlbum::storyAlbum()
  : id_()
  , name_()
  , photo_icon_()
  , video_icon_()
{}

storyAlbum::storyAlbum(int32 id_, string const &name_, object_ptr<photo> &&photo_icon_, object_ptr<video> &&video_icon_)
  : id_(id_)
  , name_(name_)
  , photo_icon_(std::move(photo_icon_))
  , video_icon_(std::move(video_icon_))
{}

const std::int32_t storyAlbum::ID;

object_ptr<storyAlbum> storyAlbum::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyAlbum> res = make_object<storyAlbum>();
  res->id_ = env->GetIntField(p, res->id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->photo_icon_ = jni::fetch_tl_object<photo>(env, jni::fetch_object(env, p, res->photo_icon_fieldID));
  res->video_icon_ = jni::fetch_tl_object<video>(env, jni::fetch_object(env, p, res->video_icon_fieldID));
  return res;
}

void storyAlbum::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 (photo_icon_ != nullptr) { jobject next; photo_icon_->store(env, next); if (next) { env->SetObjectField(s, photo_icon_fieldID, next); env->DeleteLocalRef(next); } }
  if (video_icon_ != nullptr) { jobject next; video_icon_->store(env, next); if (next) { env->SetObjectField(s, video_icon_fieldID, next); env->DeleteLocalRef(next); } }
}

void storyAlbum::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryAlbum");
    s.store_field("id", id_);
    s.store_field("name", name_);
    s.store_object_field("photoIcon", static_cast<const BaseObject *>(photo_icon_.get()));
    s.store_object_field("videoIcon", static_cast<const BaseObject *>(video_icon_.get()));
    s.store_class_end();
  }
}

void storyAlbum::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryAlbum").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "I");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    photo_icon_fieldID = jni::get_field_id(env, Class, "photoIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Photo;").c_str());
    video_icon_fieldID = jni::get_field_id(env, Class, "videoIcon", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$Video;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass storyAreaPosition::Class;
jfieldID storyAreaPosition::x_percentage_fieldID;
jfieldID storyAreaPosition::y_percentage_fieldID;
jfieldID storyAreaPosition::width_percentage_fieldID;
jfieldID storyAreaPosition::height_percentage_fieldID;
jfieldID storyAreaPosition::rotation_angle_fieldID;
jfieldID storyAreaPosition::corner_radius_percentage_fieldID;

storyAreaPosition::storyAreaPosition()
  : x_percentage_()
  , y_percentage_()
  , width_percentage_()
  , height_percentage_()
  , rotation_angle_()
  , corner_radius_percentage_()
{}

storyAreaPosition::storyAreaPosition(double x_percentage_, double y_percentage_, double width_percentage_, double height_percentage_, double rotation_angle_, double corner_radius_percentage_)
  : x_percentage_(x_percentage_)
  , y_percentage_(y_percentage_)
  , width_percentage_(width_percentage_)
  , height_percentage_(height_percentage_)
  , rotation_angle_(rotation_angle_)
  , corner_radius_percentage_(corner_radius_percentage_)
{}

const std::int32_t storyAreaPosition::ID;

object_ptr<storyAreaPosition> storyAreaPosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyAreaPosition> res = make_object<storyAreaPosition>();
  res->x_percentage_ = env->GetDoubleField(p, res->x_percentage_fieldID);
  res->y_percentage_ = env->GetDoubleField(p, res->y_percentage_fieldID);
  res->width_percentage_ = env->GetDoubleField(p, res->width_percentage_fieldID);
  res->height_percentage_ = env->GetDoubleField(p, res->height_percentage_fieldID);
  res->rotation_angle_ = env->GetDoubleField(p, res->rotation_angle_fieldID);
  res->corner_radius_percentage_ = env->GetDoubleField(p, res->corner_radius_percentage_fieldID);
  return res;
}

void storyAreaPosition::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetDoubleField(s, x_percentage_fieldID, x_percentage_);
  env->SetDoubleField(s, y_percentage_fieldID, y_percentage_);
  env->SetDoubleField(s, width_percentage_fieldID, width_percentage_);
  env->SetDoubleField(s, height_percentage_fieldID, height_percentage_);
  env->SetDoubleField(s, rotation_angle_fieldID, rotation_angle_);
  env->SetDoubleField(s, corner_radius_percentage_fieldID, corner_radius_percentage_);
}

void storyAreaPosition::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryAreaPosition");
    s.store_field("xPercentage", x_percentage_);
    s.store_field("yPercentage", y_percentage_);
    s.store_field("widthPercentage", width_percentage_);
    s.store_field("heightPercentage", height_percentage_);
    s.store_field("rotationAngle", rotation_angle_);
    s.store_field("cornerRadiusPercentage", corner_radius_percentage_);
    s.store_class_end();
  }
}

void storyAreaPosition::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StoryAreaPosition").c_str());
    x_percentage_fieldID = jni::get_field_id(env, Class, "xPercentage", "D");
    y_percentage_fieldID = jni::get_field_id(env, Class, "yPercentage", "D");
    width_percentage_fieldID = jni::get_field_id(env, Class, "widthPercentage", "D");
    height_percentage_fieldID = jni::get_field_id(env, Class, "heightPercentage", "D");
    rotation_angle_fieldID = jni::get_field_id(env, Class, "rotationAngle", "D");
    corner_radius_percentage_fieldID = jni::get_field_id(env, Class, "cornerRadiusPercentage", "D");
    return true;
  }();
  (void)is_inited;
}

jclass StoryOrigin::Class;

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

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

jclass storyOriginPublicStory::Class;
jfieldID storyOriginPublicStory::chat_id_fieldID;
jfieldID storyOriginPublicStory::story_id_fieldID;

storyOriginPublicStory::storyOriginPublicStory()
  : chat_id_()
  , story_id_()
{}

storyOriginPublicStory::storyOriginPublicStory(int53 chat_id_, int32 story_id_)
  : chat_id_(chat_id_)
  , story_id_(story_id_)
{}

const std::int32_t storyOriginPublicStory::ID;

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

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

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

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

jclass storyOriginHiddenUser::Class;
jfieldID storyOriginHiddenUser::poster_name_fieldID;

storyOriginHiddenUser::storyOriginHiddenUser()
  : poster_name_()
{}

storyOriginHiddenUser::storyOriginHiddenUser(string const &poster_name_)
  : poster_name_(poster_name_)
{}

const std::int32_t storyOriginHiddenUser::ID;

object_ptr<StoryOrigin> storyOriginHiddenUser::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<storyOriginHiddenUser> res = make_object<storyOriginHiddenUser>();
  res->poster_name_ = jni::fetch_string(env, p, res->poster_name_fieldID);
  return std::move(res);
}

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

void storyOriginHiddenUser::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StoryOriginHiddenUser");
    s.store_field("posterName", poster_name_);
    s.store_class_end();
  }
}

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

jclass TMeUrlType::Class;

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

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

jclass tMeUrlTypeUser::Class;
jfieldID tMeUrlTypeUser::user_id_fieldID;

tMeUrlTypeUser::tMeUrlTypeUser()
  : user_id_()
{}

tMeUrlTypeUser::tMeUrlTypeUser(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t tMeUrlTypeUser::ID;

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

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

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

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

jclass tMeUrlTypeSupergroup::Class;
jfieldID tMeUrlTypeSupergroup::supergroup_id_fieldID;

tMeUrlTypeSupergroup::tMeUrlTypeSupergroup()
  : supergroup_id_()
{}

tMeUrlTypeSupergroup::tMeUrlTypeSupergroup(int53 supergroup_id_)
  : supergroup_id_(supergroup_id_)
{}

const std::int32_t tMeUrlTypeSupergroup::ID;

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

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

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

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

jclass tMeUrlTypeChatInvite::Class;
jfieldID tMeUrlTypeChatInvite::info_fieldID;

tMeUrlTypeChatInvite::tMeUrlTypeChatInvite()
  : info_()
{}

tMeUrlTypeChatInvite::tMeUrlTypeChatInvite(object_ptr<chatInviteLinkInfo> &&info_)
  : info_(std::move(info_))
{}

const std::int32_t tMeUrlTypeChatInvite::ID;

object_ptr<TMeUrlType> tMeUrlTypeChatInvite::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<tMeUrlTypeChatInvite> res = make_object<tMeUrlTypeChatInvite>();
  res->info_ = jni::fetch_tl_object<chatInviteLinkInfo>(env, jni::fetch_object(env, p, res->info_fieldID));
  return std::move(res);
}

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

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

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

jclass tMeUrlTypeStickerSet::Class;
jfieldID tMeUrlTypeStickerSet::sticker_set_id_fieldID;

tMeUrlTypeStickerSet::tMeUrlTypeStickerSet()
  : sticker_set_id_()
{}

tMeUrlTypeStickerSet::tMeUrlTypeStickerSet(int64 sticker_set_id_)
  : sticker_set_id_(sticker_set_id_)
{}

const std::int32_t tMeUrlTypeStickerSet::ID;

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

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

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

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

jclass testVectorStringObject::Class;
jfieldID testVectorStringObject::value_fieldID;

testVectorStringObject::testVectorStringObject()
  : value_()
{}

testVectorStringObject::testVectorStringObject(array<object_ptr<testString>> &&value_)
  : value_(std::move(value_))
{}

const std::int32_t testVectorStringObject::ID;

object_ptr<testVectorStringObject> testVectorStringObject::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<testVectorStringObject> res = make_object<testVectorStringObject>();
  res->value_ = jni::FetchVector<testString>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->value_fieldID));
  return res;
}

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

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

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

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

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

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

const std::int32_t tonTransactions::ID;

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

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

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

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

jclass upgradedGift::Class;
jfieldID upgradedGift::id_fieldID;
jfieldID upgradedGift::regular_gift_id_fieldID;
jfieldID upgradedGift::publisher_chat_id_fieldID;
jfieldID upgradedGift::title_fieldID;
jfieldID upgradedGift::name_fieldID;
jfieldID upgradedGift::number_fieldID;
jfieldID upgradedGift::total_upgraded_count_fieldID;
jfieldID upgradedGift::max_upgraded_count_fieldID;
jfieldID upgradedGift::is_burned_fieldID;
jfieldID upgradedGift::is_crafted_fieldID;
jfieldID upgradedGift::is_premium_fieldID;
jfieldID upgradedGift::is_theme_available_fieldID;
jfieldID upgradedGift::used_theme_chat_id_fieldID;
jfieldID upgradedGift::host_id_fieldID;
jfieldID upgradedGift::owner_id_fieldID;
jfieldID upgradedGift::owner_address_fieldID;
jfieldID upgradedGift::owner_name_fieldID;
jfieldID upgradedGift::gift_address_fieldID;
jfieldID upgradedGift::model_fieldID;
jfieldID upgradedGift::symbol_fieldID;
jfieldID upgradedGift::backdrop_fieldID;
jfieldID upgradedGift::original_details_fieldID;
jfieldID upgradedGift::colors_fieldID;
jfieldID upgradedGift::resale_parameters_fieldID;
jfieldID upgradedGift::can_send_purchase_offer_fieldID;
jfieldID upgradedGift::craft_probability_per_mille_fieldID;
jfieldID upgradedGift::value_currency_fieldID;
jfieldID upgradedGift::value_amount_fieldID;
jfieldID upgradedGift::value_usd_amount_fieldID;

upgradedGift::upgradedGift()
  : id_()
  , regular_gift_id_()
  , publisher_chat_id_()
  , title_()
  , name_()
  , number_()
  , total_upgraded_count_()
  , max_upgraded_count_()
  , is_burned_()
  , is_crafted_()
  , is_premium_()
  , is_theme_available_()
  , used_theme_chat_id_()
  , host_id_()
  , owner_id_()
  , owner_address_()
  , owner_name_()
  , gift_address_()
  , model_()
  , symbol_()
  , backdrop_()
  , original_details_()
  , colors_()
  , resale_parameters_()
  , can_send_purchase_offer_()
  , craft_probability_per_mille_()
  , value_currency_()
  , value_amount_()
  , value_usd_amount_()
{}

upgradedGift::upgradedGift(int64 id_, int64 regular_gift_id_, int53 publisher_chat_id_, string const &title_, string const &name_, int32 number_, int32 total_upgraded_count_, int32 max_upgraded_count_, bool is_burned_, bool is_crafted_, bool is_premium_, bool is_theme_available_, int53 used_theme_chat_id_, object_ptr<MessageSender> &&host_id_, object_ptr<MessageSender> &&owner_id_, string const &owner_address_, string const &owner_name_, string const &gift_address_, object_ptr<upgradedGiftModel> &&model_, object_ptr<upgradedGiftSymbol> &&symbol_, object_ptr<upgradedGiftBackdrop> &&backdrop_, object_ptr<upgradedGiftOriginalDetails> &&original_details_, object_ptr<upgradedGiftColors> &&colors_, object_ptr<giftResaleParameters> &&resale_parameters_, bool can_send_purchase_offer_, int32 craft_probability_per_mille_, string const &value_currency_, int53 value_amount_, int53 value_usd_amount_)
  : id_(id_)
  , regular_gift_id_(regular_gift_id_)
  , publisher_chat_id_(publisher_chat_id_)
  , title_(title_)
  , name_(name_)
  , number_(number_)
  , total_upgraded_count_(total_upgraded_count_)
  , max_upgraded_count_(max_upgraded_count_)
  , is_burned_(is_burned_)
  , is_crafted_(is_crafted_)
  , is_premium_(is_premium_)
  , is_theme_available_(is_theme_available_)
  , used_theme_chat_id_(used_theme_chat_id_)
  , host_id_(std::move(host_id_))
  , owner_id_(std::move(owner_id_))
  , owner_address_(owner_address_)
  , owner_name_(owner_name_)
  , gift_address_(gift_address_)
  , model_(std::move(model_))
  , symbol_(std::move(symbol_))
  , backdrop_(std::move(backdrop_))
  , original_details_(std::move(original_details_))
  , colors_(std::move(colors_))
  , resale_parameters_(std::move(resale_parameters_))
  , can_send_purchase_offer_(can_send_purchase_offer_)
  , craft_probability_per_mille_(craft_probability_per_mille_)
  , value_currency_(value_currency_)
  , value_amount_(value_amount_)
  , value_usd_amount_(value_usd_amount_)
{}

const std::int32_t upgradedGift::ID;

object_ptr<upgradedGift> upgradedGift::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGift> res = make_object<upgradedGift>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->regular_gift_id_ = env->GetLongField(p, res->regular_gift_id_fieldID);
  res->publisher_chat_id_ = env->GetLongField(p, res->publisher_chat_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->number_ = env->GetIntField(p, res->number_fieldID);
  res->total_upgraded_count_ = env->GetIntField(p, res->total_upgraded_count_fieldID);
  res->max_upgraded_count_ = env->GetIntField(p, res->max_upgraded_count_fieldID);
  res->is_burned_ = (env->GetBooleanField(p, res->is_burned_fieldID) != 0);
  res->is_crafted_ = (env->GetBooleanField(p, res->is_crafted_fieldID) != 0);
  res->is_premium_ = (env->GetBooleanField(p, res->is_premium_fieldID) != 0);
  res->is_theme_available_ = (env->GetBooleanField(p, res->is_theme_available_fieldID) != 0);
  res->used_theme_chat_id_ = env->GetLongField(p, res->used_theme_chat_id_fieldID);
  res->host_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->host_id_fieldID));
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->owner_address_ = jni::fetch_string(env, p, res->owner_address_fieldID);
  res->owner_name_ = jni::fetch_string(env, p, res->owner_name_fieldID);
  res->gift_address_ = jni::fetch_string(env, p, res->gift_address_fieldID);
  res->model_ = jni::fetch_tl_object<upgradedGiftModel>(env, jni::fetch_object(env, p, res->model_fieldID));
  res->symbol_ = jni::fetch_tl_object<upgradedGiftSymbol>(env, jni::fetch_object(env, p, res->symbol_fieldID));
  res->backdrop_ = jni::fetch_tl_object<upgradedGiftBackdrop>(env, jni::fetch_object(env, p, res->backdrop_fieldID));
  res->original_details_ = jni::fetch_tl_object<upgradedGiftOriginalDetails>(env, jni::fetch_object(env, p, res->original_details_fieldID));
  res->colors_ = jni::fetch_tl_object<upgradedGiftColors>(env, jni::fetch_object(env, p, res->colors_fieldID));
  res->resale_parameters_ = jni::fetch_tl_object<giftResaleParameters>(env, jni::fetch_object(env, p, res->resale_parameters_fieldID));
  res->can_send_purchase_offer_ = (env->GetBooleanField(p, res->can_send_purchase_offer_fieldID) != 0);
  res->craft_probability_per_mille_ = env->GetIntField(p, res->craft_probability_per_mille_fieldID);
  res->value_currency_ = jni::fetch_string(env, p, res->value_currency_fieldID);
  res->value_amount_ = env->GetLongField(p, res->value_amount_fieldID);
  res->value_usd_amount_ = env->GetLongField(p, res->value_usd_amount_fieldID);
  return res;
}

void upgradedGift::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, regular_gift_id_fieldID, regular_gift_id_);
  env->SetLongField(s, publisher_chat_id_fieldID, publisher_chat_id_);
  { jstring nextString = jni::to_jstring(env, title_); if (nextString) { env->SetObjectField(s, title_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, name_); if (nextString) { env->SetObjectField(s, name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetIntField(s, number_fieldID, number_);
  env->SetIntField(s, total_upgraded_count_fieldID, total_upgraded_count_);
  env->SetIntField(s, max_upgraded_count_fieldID, max_upgraded_count_);
  env->SetBooleanField(s, is_burned_fieldID, is_burned_);
  env->SetBooleanField(s, is_crafted_fieldID, is_crafted_);
  env->SetBooleanField(s, is_premium_fieldID, is_premium_);
  env->SetBooleanField(s, is_theme_available_fieldID, is_theme_available_);
  env->SetLongField(s, used_theme_chat_id_fieldID, used_theme_chat_id_);
  if (host_id_ != nullptr) { jobject next; host_id_->store(env, next); if (next) { env->SetObjectField(s, host_id_fieldID, next); env->DeleteLocalRef(next); } }
  if (owner_id_ != nullptr) { jobject next; owner_id_->store(env, next); if (next) { env->SetObjectField(s, owner_id_fieldID, next); env->DeleteLocalRef(next); } }
  { jstring nextString = jni::to_jstring(env, owner_address_); if (nextString) { env->SetObjectField(s, owner_address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, owner_name_); if (nextString) { env->SetObjectField(s, owner_name_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  { jstring nextString = jni::to_jstring(env, gift_address_); if (nextString) { env->SetObjectField(s, gift_address_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  if (model_ != nullptr) { jobject next; model_->store(env, next); if (next) { env->SetObjectField(s, model_fieldID, next); env->DeleteLocalRef(next); } }
  if (symbol_ != nullptr) { jobject next; symbol_->store(env, next); if (next) { env->SetObjectField(s, symbol_fieldID, next); env->DeleteLocalRef(next); } }
  if (backdrop_ != nullptr) { jobject next; backdrop_->store(env, next); if (next) { env->SetObjectField(s, backdrop_fieldID, next); env->DeleteLocalRef(next); } }
  if (original_details_ != nullptr) { jobject next; original_details_->store(env, next); if (next) { env->SetObjectField(s, original_details_fieldID, next); env->DeleteLocalRef(next); } }
  if (colors_ != nullptr) { jobject next; colors_->store(env, next); if (next) { env->SetObjectField(s, colors_fieldID, next); env->DeleteLocalRef(next); } }
  if (resale_parameters_ != nullptr) { jobject next; resale_parameters_->store(env, next); if (next) { env->SetObjectField(s, resale_parameters_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetBooleanField(s, can_send_purchase_offer_fieldID, can_send_purchase_offer_);
  env->SetIntField(s, craft_probability_per_mille_fieldID, craft_probability_per_mille_);
  { jstring nextString = jni::to_jstring(env, value_currency_); if (nextString) { env->SetObjectField(s, value_currency_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  env->SetLongField(s, value_amount_fieldID, value_amount_);
  env->SetLongField(s, value_usd_amount_fieldID, value_usd_amount_);
}

void upgradedGift::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGift");
    s.store_field("id", id_);
    s.store_field("regularGiftId", regular_gift_id_);
    s.store_field("publisherChatId", publisher_chat_id_);
    s.store_field("title", title_);
    s.store_field("name", name_);
    s.store_field("number", number_);
    s.store_field("totalUpgradedCount", total_upgraded_count_);
    s.store_field("maxUpgradedCount", max_upgraded_count_);
    s.store_field("isBurned", is_burned_);
    s.store_field("isCrafted", is_crafted_);
    s.store_field("isPremium", is_premium_);
    s.store_field("isThemeAvailable", is_theme_available_);
    s.store_field("usedThemeChatId", used_theme_chat_id_);
    s.store_object_field("hostId", static_cast<const BaseObject *>(host_id_.get()));
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("ownerAddress", owner_address_);
    s.store_field("ownerName", owner_name_);
    s.store_field("giftAddress", gift_address_);
    s.store_object_field("model", static_cast<const BaseObject *>(model_.get()));
    s.store_object_field("symbol", static_cast<const BaseObject *>(symbol_.get()));
    s.store_object_field("backdrop", static_cast<const BaseObject *>(backdrop_.get()));
    s.store_object_field("originalDetails", static_cast<const BaseObject *>(original_details_.get()));
    s.store_object_field("colors", static_cast<const BaseObject *>(colors_.get()));
    s.store_object_field("resaleParameters", static_cast<const BaseObject *>(resale_parameters_.get()));
    s.store_field("canSendPurchaseOffer", can_send_purchase_offer_);
    s.store_field("craftProbabilityPerMille", craft_probability_per_mille_);
    s.store_field("valueCurrency", value_currency_);
    s.store_field("valueAmount", value_amount_);
    s.store_field("valueUsdAmount", value_usd_amount_);
    s.store_class_end();
  }
}

void upgradedGift::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGift").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    regular_gift_id_fieldID = jni::get_field_id(env, Class, "regularGiftId", "J");
    publisher_chat_id_fieldID = jni::get_field_id(env, Class, "publisherChatId", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    number_fieldID = jni::get_field_id(env, Class, "number", "I");
    total_upgraded_count_fieldID = jni::get_field_id(env, Class, "totalUpgradedCount", "I");
    max_upgraded_count_fieldID = jni::get_field_id(env, Class, "maxUpgradedCount", "I");
    is_burned_fieldID = jni::get_field_id(env, Class, "isBurned", "Z");
    is_crafted_fieldID = jni::get_field_id(env, Class, "isCrafted", "Z");
    is_premium_fieldID = jni::get_field_id(env, Class, "isPremium", "Z");
    is_theme_available_fieldID = jni::get_field_id(env, Class, "isThemeAvailable", "Z");
    used_theme_chat_id_fieldID = jni::get_field_id(env, Class, "usedThemeChatId", "J");
    host_id_fieldID = jni::get_field_id(env, Class, "hostId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    owner_address_fieldID = jni::get_field_id(env, Class, "ownerAddress", "Ljava/lang/String;");
    owner_name_fieldID = jni::get_field_id(env, Class, "ownerName", "Ljava/lang/String;");
    gift_address_fieldID = jni::get_field_id(env, Class, "giftAddress", "Ljava/lang/String;");
    model_fieldID = jni::get_field_id(env, Class, "model", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftModel;").c_str());
    symbol_fieldID = jni::get_field_id(env, Class, "symbol", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftSymbol;").c_str());
    backdrop_fieldID = jni::get_field_id(env, Class, "backdrop", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftBackdrop;").c_str());
    original_details_fieldID = jni::get_field_id(env, Class, "originalDetails", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftOriginalDetails;").c_str());
    colors_fieldID = jni::get_field_id(env, Class, "colors", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$UpgradedGiftColors;").c_str());
    resale_parameters_fieldID = jni::get_field_id(env, Class, "resaleParameters", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$GiftResaleParameters;").c_str());
    can_send_purchase_offer_fieldID = jni::get_field_id(env, Class, "canSendPurchaseOffer", "Z");
    craft_probability_per_mille_fieldID = jni::get_field_id(env, Class, "craftProbabilityPerMille", "I");
    value_currency_fieldID = jni::get_field_id(env, Class, "valueCurrency", "Ljava/lang/String;");
    value_amount_fieldID = jni::get_field_id(env, Class, "valueAmount", "J");
    value_usd_amount_fieldID = jni::get_field_id(env, Class, "valueUsdAmount", "J");
    return true;
  }();
  (void)is_inited;
}

jclass upgradedGiftColors::Class;
jfieldID upgradedGiftColors::id_fieldID;
jfieldID upgradedGiftColors::model_custom_emoji_id_fieldID;
jfieldID upgradedGiftColors::symbol_custom_emoji_id_fieldID;
jfieldID upgradedGiftColors::light_theme_accent_color_fieldID;
jfieldID upgradedGiftColors::light_theme_colors_fieldID;
jfieldID upgradedGiftColors::dark_theme_accent_color_fieldID;
jfieldID upgradedGiftColors::dark_theme_colors_fieldID;

upgradedGiftColors::upgradedGiftColors()
  : id_()
  , model_custom_emoji_id_()
  , symbol_custom_emoji_id_()
  , light_theme_accent_color_()
  , light_theme_colors_()
  , dark_theme_accent_color_()
  , dark_theme_colors_()
{}

upgradedGiftColors::upgradedGiftColors(int64 id_, int64 model_custom_emoji_id_, int64 symbol_custom_emoji_id_, int32 light_theme_accent_color_, array<int32> &&light_theme_colors_, int32 dark_theme_accent_color_, array<int32> &&dark_theme_colors_)
  : id_(id_)
  , model_custom_emoji_id_(model_custom_emoji_id_)
  , symbol_custom_emoji_id_(symbol_custom_emoji_id_)
  , light_theme_accent_color_(light_theme_accent_color_)
  , light_theme_colors_(std::move(light_theme_colors_))
  , dark_theme_accent_color_(dark_theme_accent_color_)
  , dark_theme_colors_(std::move(dark_theme_colors_))
{}

const std::int32_t upgradedGiftColors::ID;

object_ptr<upgradedGiftColors> upgradedGiftColors::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftColors> res = make_object<upgradedGiftColors>();
  res->id_ = env->GetLongField(p, res->id_fieldID);
  res->model_custom_emoji_id_ = env->GetLongField(p, res->model_custom_emoji_id_fieldID);
  res->symbol_custom_emoji_id_ = env->GetLongField(p, res->symbol_custom_emoji_id_fieldID);
  res->light_theme_accent_color_ = env->GetIntField(p, res->light_theme_accent_color_fieldID);
  res->light_theme_colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->light_theme_colors_fieldID));
  res->dark_theme_accent_color_ = env->GetIntField(p, res->dark_theme_accent_color_fieldID);
  res->dark_theme_colors_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->dark_theme_colors_fieldID));
  return res;
}

void upgradedGiftColors::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  env->SetLongField(s, id_fieldID, id_);
  env->SetLongField(s, model_custom_emoji_id_fieldID, model_custom_emoji_id_);
  env->SetLongField(s, symbol_custom_emoji_id_fieldID, symbol_custom_emoji_id_);
  env->SetIntField(s, light_theme_accent_color_fieldID, light_theme_accent_color_);
  { auto arr_tmp_ = jni::store_vector(env, light_theme_colors_); if (arr_tmp_) { env->SetObjectField(s, light_theme_colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
  env->SetIntField(s, dark_theme_accent_color_fieldID, dark_theme_accent_color_);
  { auto arr_tmp_ = jni::store_vector(env, dark_theme_colors_); if (arr_tmp_) { env->SetObjectField(s, dark_theme_colors_fieldID, arr_tmp_); env->DeleteLocalRef(arr_tmp_); } }
}

void upgradedGiftColors::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftColors");
    s.store_field("id", id_);
    s.store_field("modelCustomEmojiId", model_custom_emoji_id_);
    s.store_field("symbolCustomEmojiId", symbol_custom_emoji_id_);
    s.store_field("lightThemeAccentColor", light_theme_accent_color_);
    { s.store_vector_begin("lightThemeColors", light_theme_colors_.size()); for (const auto &_value : light_theme_colors_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("darkThemeAccentColor", dark_theme_accent_color_);
    { s.store_vector_begin("darkThemeColors", dark_theme_colors_.size()); for (const auto &_value : dark_theme_colors_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

void upgradedGiftColors::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UpgradedGiftColors").c_str());
    id_fieldID = jni::get_field_id(env, Class, "id", "J");
    model_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "modelCustomEmojiId", "J");
    symbol_custom_emoji_id_fieldID = jni::get_field_id(env, Class, "symbolCustomEmojiId", "J");
    light_theme_accent_color_fieldID = jni::get_field_id(env, Class, "lightThemeAccentColor", "I");
    light_theme_colors_fieldID = jni::get_field_id(env, Class, "lightThemeColors", "[I");
    dark_theme_accent_color_fieldID = jni::get_field_id(env, Class, "darkThemeAccentColor", "I");
    dark_theme_colors_fieldID = jni::get_field_id(env, Class, "darkThemeColors", "[I");
    return true;
  }();
  (void)is_inited;
}

jclass upgradedGiftSymbolCount::Class;
jfieldID upgradedGiftSymbolCount::symbol_fieldID;
jfieldID upgradedGiftSymbolCount::total_count_fieldID;

upgradedGiftSymbolCount::upgradedGiftSymbolCount()
  : symbol_()
  , total_count_()
{}

upgradedGiftSymbolCount::upgradedGiftSymbolCount(object_ptr<upgradedGiftSymbol> &&symbol_, int32 total_count_)
  : symbol_(std::move(symbol_))
  , total_count_(total_count_)
{}

const std::int32_t upgradedGiftSymbolCount::ID;

object_ptr<upgradedGiftSymbolCount> upgradedGiftSymbolCount::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<upgradedGiftSymbolCount> res = make_object<upgradedGiftSymbolCount>();
  res->symbol_ = jni::fetch_tl_object<upgradedGiftSymbol>(env, jni::fetch_object(env, p, res->symbol_fieldID));
  res->total_count_ = env->GetIntField(p, res->total_count_fieldID);
  return res;
}

void upgradedGiftSymbolCount::store(JNIEnv *env, jobject &s) const {
  init_jni_vars(env);
  s = env->AllocObject(Class);
  if (!s) { return; }
  if (symbol_ != nullptr) { jobject next; symbol_->store(env, next); if (next) { env->SetObjectField(s, symbol_fieldID, next); env->DeleteLocalRef(next); } }
  env->SetIntField(s, total_count_fieldID, total_count_);
}

void upgradedGiftSymbolCount::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "UpgradedGiftSymbolCount");
    s.store_object_field("symbol", static_cast<const BaseObject *>(symbol_.get()));
    s.store_field("totalCount", total_count_);
    s.store_class_end();
  }
}

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

jclass voiceNote::Class;
jfieldID voiceNote::duration_fieldID;
jfieldID voiceNote::waveform_fieldID;
jfieldID voiceNote::mime_type_fieldID;
jfieldID voiceNote::speech_recognition_result_fieldID;
jfieldID voiceNote::voice_fieldID;

voiceNote::voiceNote()
  : duration_()
  , waveform_()
  , mime_type_()
  , speech_recognition_result_()
  , voice_()
{}

voiceNote::voiceNote(int32 duration_, bytes const &waveform_, string const &mime_type_, object_ptr<SpeechRecognitionResult> &&speech_recognition_result_, object_ptr<file> &&voice_)
  : duration_(duration_)
  , waveform_(std::move(waveform_))
  , mime_type_(mime_type_)
  , speech_recognition_result_(std::move(speech_recognition_result_))
  , voice_(std::move(voice_))
{}

const std::int32_t voiceNote::ID;

object_ptr<voiceNote> voiceNote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<voiceNote> res = make_object<voiceNote>();
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->waveform_ = jni::from_bytes(env, (jbyteArray)jni::fetch_object(env, p, res->waveform_fieldID));
  res->mime_type_ = jni::fetch_string(env, p, res->mime_type_fieldID);
  res->speech_recognition_result_ = jni::fetch_tl_object<SpeechRecognitionResult>(env, jni::fetch_object(env, p, res->speech_recognition_result_fieldID));
  res->voice_ = jni::fetch_tl_object<file>(env, jni::fetch_object(env, p, res->voice_fieldID));
  return res;
}

void voiceNote::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); } }
  { jstring nextString = jni::to_jstring(env, mime_type_); if (nextString) { env->SetObjectField(s, mime_type_fieldID, nextString); env->DeleteLocalRef(nextString); } }
  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 (voice_ != nullptr) { jobject next; voice_->store(env, next); if (next) { env->SetObjectField(s, voice_fieldID, next); env->DeleteLocalRef(next); } }
}

void voiceNote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "VoiceNote");
    s.store_field("duration", duration_);
    s.store_bytes_field("waveform", waveform_);
    s.store_field("mimeType", mime_type_);
    s.store_object_field("speechRecognitionResult", static_cast<const BaseObject *>(speech_recognition_result_.get()));
    s.store_object_field("voice", static_cast<const BaseObject *>(voice_.get()));
    s.store_class_end();
  }
}

void voiceNote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$VoiceNote").c_str());
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    waveform_fieldID = jni::get_field_id(env, Class, "waveform", "[B");
    mime_type_fieldID = jni::get_field_id(env, Class, "mimeType", "Ljava/lang/String;");
    speech_recognition_result_fieldID = jni::get_field_id(env, Class, "speechRecognitionResult", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SpeechRecognitionResult;").c_str());
    voice_fieldID = jni::get_field_id(env, Class, "voice", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$File;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass addBotMediaPreview::Class;
jfieldID addBotMediaPreview::bot_user_id_fieldID;
jfieldID addBotMediaPreview::language_code_fieldID;
jfieldID addBotMediaPreview::content_fieldID;

addBotMediaPreview::addBotMediaPreview()
  : bot_user_id_()
  , language_code_()
  , content_()
{}

addBotMediaPreview::addBotMediaPreview(int53 bot_user_id_, string const &language_code_, object_ptr<InputStoryContent> &&content_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
  , content_(std::move(content_))
{}

const std::int32_t addBotMediaPreview::ID;

object_ptr<addBotMediaPreview> addBotMediaPreview::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addBotMediaPreview> res = make_object<addBotMediaPreview>();
  res->bot_user_id_ = env->GetLongField(p, res->bot_user_id_fieldID);
  res->language_code_ = jni::fetch_string(env, p, res->language_code_fieldID);
  res->content_ = jni::fetch_tl_object<InputStoryContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  return res;
}

void addBotMediaPreview::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddBotMediaPreview");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_class_end();
  }
}

addBotMediaPreview::ReturnType addBotMediaPreview::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return botMediaPreview::fetch(env, p);
}

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

jclass addCustomServerLanguagePack::Class;
jfieldID addCustomServerLanguagePack::language_pack_id_fieldID;

addCustomServerLanguagePack::addCustomServerLanguagePack()
  : language_pack_id_()
{}

addCustomServerLanguagePack::addCustomServerLanguagePack(string const &language_pack_id_)
  : language_pack_id_(language_pack_id_)
{}

const std::int32_t addCustomServerLanguagePack::ID;

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

void addCustomServerLanguagePack::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddCustomServerLanguagePack");
    s.store_field("languagePackId", language_pack_id_);
    s.store_class_end();
  }
}

addCustomServerLanguagePack::ReturnType addCustomServerLanguagePack::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass addFavoriteSticker::Class;
jfieldID addFavoriteSticker::sticker_fieldID;

addFavoriteSticker::addFavoriteSticker()
  : sticker_()
{}

addFavoriteSticker::addFavoriteSticker(object_ptr<InputFile> &&sticker_)
  : sticker_(std::move(sticker_))
{}

const std::int32_t addFavoriteSticker::ID;

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

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

addFavoriteSticker::ReturnType addFavoriteSticker::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void addFavoriteSticker::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddFavoriteSticker").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 addGiftCollectionGifts::Class;
jfieldID addGiftCollectionGifts::owner_id_fieldID;
jfieldID addGiftCollectionGifts::collection_id_fieldID;
jfieldID addGiftCollectionGifts::received_gift_ids_fieldID;

addGiftCollectionGifts::addGiftCollectionGifts()
  : owner_id_()
  , collection_id_()
  , received_gift_ids_()
{}

addGiftCollectionGifts::addGiftCollectionGifts(object_ptr<MessageSender> &&owner_id_, int32 collection_id_, array<string> &&received_gift_ids_)
  : owner_id_(std::move(owner_id_))
  , collection_id_(collection_id_)
  , received_gift_ids_(std::move(received_gift_ids_))
{}

const std::int32_t addGiftCollectionGifts::ID;

object_ptr<addGiftCollectionGifts> addGiftCollectionGifts::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<addGiftCollectionGifts> res = make_object<addGiftCollectionGifts>();
  res->owner_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->owner_id_fieldID));
  res->collection_id_ = env->GetIntField(p, res->collection_id_fieldID);
  res->received_gift_ids_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->received_gift_ids_fieldID));
  return res;
}

void addGiftCollectionGifts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "AddGiftCollectionGifts");
    s.store_object_field("ownerId", static_cast<const BaseObject *>(owner_id_.get()));
    s.store_field("collectionId", collection_id_);
    { s.store_vector_begin("receivedGiftIds", received_gift_ids_.size()); for (const auto &_value : received_gift_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

addGiftCollectionGifts::ReturnType addGiftCollectionGifts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftCollection::fetch(env, p);
}

void addGiftCollectionGifts::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$AddGiftCollectionGifts").c_str());
    owner_id_fieldID = jni::get_field_id(env, Class, "ownerId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    collection_id_fieldID = jni::get_field_id(env, Class, "collectionId", "I");
    received_gift_ids_fieldID = jni::get_field_id(env, Class, "receivedGiftIds", "[Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass addSavedAnimation::Class;
jfieldID addSavedAnimation::animation_fieldID;

addSavedAnimation::addSavedAnimation()
  : animation_()
{}

addSavedAnimation::addSavedAnimation(object_ptr<InputFile> &&animation_)
  : animation_(std::move(animation_))
{}

const std::int32_t addSavedAnimation::ID;

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

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

addSavedAnimation::ReturnType addSavedAnimation::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

assignStoreTransaction::assignStoreTransaction()
  : transaction_()
  , purpose_()
{}

assignStoreTransaction::assignStoreTransaction(object_ptr<StoreTransaction> &&transaction_, object_ptr<StorePaymentPurpose> &&purpose_)
  : transaction_(std::move(transaction_))
  , purpose_(std::move(purpose_))
{}

const std::int32_t assignStoreTransaction::ID;

object_ptr<assignStoreTransaction> assignStoreTransaction::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<assignStoreTransaction> res = make_object<assignStoreTransaction>();
  res->transaction_ = jni::fetch_tl_object<StoreTransaction>(env, jni::fetch_object(env, p, res->transaction_fieldID));
  res->purpose_ = jni::fetch_tl_object<StorePaymentPurpose>(env, jni::fetch_object(env, p, res->purpose_fieldID));
  return res;
}

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

assignStoreTransaction::ReturnType assignStoreTransaction::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clearAutosaveSettingsExceptions::Class;

clearAutosaveSettingsExceptions::clearAutosaveSettingsExceptions() {
}

const std::int32_t clearAutosaveSettingsExceptions::ID;

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

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

clearAutosaveSettingsExceptions::ReturnType clearAutosaveSettingsExceptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clearImportedContacts::Class;

clearImportedContacts::clearImportedContacts() {
}

const std::int32_t clearImportedContacts::ID;

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

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

clearImportedContacts::ReturnType clearImportedContacts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clearRecentStickers::Class;
jfieldID clearRecentStickers::is_attached_fieldID;

clearRecentStickers::clearRecentStickers()
  : is_attached_()
{}

clearRecentStickers::clearRecentStickers(bool is_attached_)
  : is_attached_(is_attached_)
{}

const std::int32_t clearRecentStickers::ID;

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

void clearRecentStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ClearRecentStickers");
    s.store_field("isAttached", is_attached_);
    s.store_class_end();
  }
}

clearRecentStickers::ReturnType clearRecentStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clearRecentlyFoundChats::Class;

clearRecentlyFoundChats::clearRecentlyFoundChats() {
}

const std::int32_t clearRecentlyFoundChats::ID;

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

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

clearRecentlyFoundChats::ReturnType clearRecentlyFoundChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass clickPremiumSubscriptionButton::Class;

clickPremiumSubscriptionButton::clickPremiumSubscriptionButton() {
}

const std::int32_t clickPremiumSubscriptionButton::ID;

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

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

clickPremiumSubscriptionButton::ReturnType clickPremiumSubscriptionButton::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass createBot::Class;
jfieldID createBot::manager_bot_user_id_fieldID;
jfieldID createBot::name_fieldID;
jfieldID createBot::username_fieldID;
jfieldID createBot::via_link_fieldID;

createBot::createBot()
  : manager_bot_user_id_()
  , name_()
  , username_()
  , via_link_()
{}

createBot::createBot(int53 manager_bot_user_id_, string const &name_, string const &username_, bool via_link_)
  : manager_bot_user_id_(manager_bot_user_id_)
  , name_(name_)
  , username_(username_)
  , via_link_(via_link_)
{}

const std::int32_t createBot::ID;

object_ptr<createBot> createBot::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createBot> res = make_object<createBot>();
  res->manager_bot_user_id_ = env->GetLongField(p, res->manager_bot_user_id_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  res->via_link_ = (env->GetBooleanField(p, res->via_link_fieldID) != 0);
  return res;
}

void createBot::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateBot");
    s.store_field("managerBotUserId", manager_bot_user_id_);
    s.store_field("name", name_);
    s.store_field("username", username_);
    s.store_field("viaLink", via_link_);
    s.store_class_end();
  }
}

createBot::ReturnType createBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return user::fetch(env, p);
}

void createBot::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateBot").c_str());
    manager_bot_user_id_fieldID = jni::get_field_id(env, Class, "managerBotUserId", "J");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    username_fieldID = jni::get_field_id(env, Class, "username", "Ljava/lang/String;");
    via_link_fieldID = jni::get_field_id(env, Class, "viaLink", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass createChatFolderInviteLink::Class;
jfieldID createChatFolderInviteLink::chat_folder_id_fieldID;
jfieldID createChatFolderInviteLink::name_fieldID;
jfieldID createChatFolderInviteLink::chat_ids_fieldID;

createChatFolderInviteLink::createChatFolderInviteLink()
  : chat_folder_id_()
  , name_()
  , chat_ids_()
{}

createChatFolderInviteLink::createChatFolderInviteLink(int32 chat_folder_id_, string const &name_, array<int53> &&chat_ids_)
  : chat_folder_id_(chat_folder_id_)
  , name_(name_)
  , chat_ids_(std::move(chat_ids_))
{}

const std::int32_t createChatFolderInviteLink::ID;

object_ptr<createChatFolderInviteLink> createChatFolderInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createChatFolderInviteLink> res = make_object<createChatFolderInviteLink>();
  res->chat_folder_id_ = env->GetIntField(p, res->chat_folder_id_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 createChatFolderInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateChatFolderInviteLink");
    s.store_field("chatFolderId", chat_folder_id_);
    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();
  }
}

createChatFolderInviteLink::ReturnType createChatFolderInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatFolderInviteLink::fetch(env, p);
}

void createChatFolderInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateChatFolderInviteLink").c_str());
    chat_folder_id_fieldID = jni::get_field_id(env, Class, "chatFolderId", "I");
    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 createNewStickerSet::Class;
jfieldID createNewStickerSet::user_id_fieldID;
jfieldID createNewStickerSet::title_fieldID;
jfieldID createNewStickerSet::name_fieldID;
jfieldID createNewStickerSet::sticker_type_fieldID;
jfieldID createNewStickerSet::needs_repainting_fieldID;
jfieldID createNewStickerSet::stickers_fieldID;
jfieldID createNewStickerSet::source_fieldID;

createNewStickerSet::createNewStickerSet()
  : user_id_()
  , title_()
  , name_()
  , sticker_type_()
  , needs_repainting_()
  , stickers_()
  , source_()
{}

createNewStickerSet::createNewStickerSet(int53 user_id_, string const &title_, string const &name_, object_ptr<StickerType> &&sticker_type_, bool needs_repainting_, array<object_ptr<inputSticker>> &&stickers_, string const &source_)
  : user_id_(user_id_)
  , title_(title_)
  , name_(name_)
  , sticker_type_(std::move(sticker_type_))
  , needs_repainting_(needs_repainting_)
  , stickers_(std::move(stickers_))
  , source_(source_)
{}

const std::int32_t createNewStickerSet::ID;

object_ptr<createNewStickerSet> createNewStickerSet::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<createNewStickerSet> res = make_object<createNewStickerSet>();
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->needs_repainting_ = (env->GetBooleanField(p, res->needs_repainting_fieldID) != 0);
  res->stickers_ = jni::FetchVector<inputSticker>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->stickers_fieldID));
  res->source_ = jni::fetch_string(env, p, res->source_fieldID);
  return res;
}

void createNewStickerSet::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "CreateNewStickerSet");
    s.store_field("userId", user_id_);
    s.store_field("title", title_);
    s.store_field("name", name_);
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("needsRepainting", needs_repainting_);
    { s.store_vector_begin("stickers", stickers_.size()); for (const auto &_value : stickers_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_field("source", source_);
    s.store_class_end();
  }
}

createNewStickerSet::ReturnType createNewStickerSet::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickerSet::fetch(env, p);
}

void createNewStickerSet::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$CreateNewStickerSet").c_str());
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    needs_repainting_fieldID = jni::get_field_id(env, Class, "needsRepainting", "Z");
    stickers_fieldID = jni::get_field_id(env, Class, "stickers", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputSticker;").c_str());
    source_fieldID = jni::get_field_id(env, Class, "source", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass deleteDirectMessagesChatTopicHistory::Class;
jfieldID deleteDirectMessagesChatTopicHistory::chat_id_fieldID;
jfieldID deleteDirectMessagesChatTopicHistory::topic_id_fieldID;

deleteDirectMessagesChatTopicHistory::deleteDirectMessagesChatTopicHistory()
  : chat_id_()
  , topic_id_()
{}

deleteDirectMessagesChatTopicHistory::deleteDirectMessagesChatTopicHistory(int53 chat_id_, int53 topic_id_)
  : chat_id_(chat_id_)
  , topic_id_(topic_id_)
{}

const std::int32_t deleteDirectMessagesChatTopicHistory::ID;

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

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

deleteDirectMessagesChatTopicHistory::ReturnType deleteDirectMessagesChatTopicHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass deleteSavedMessagesTopicHistory::Class;
jfieldID deleteSavedMessagesTopicHistory::saved_messages_topic_id_fieldID;

deleteSavedMessagesTopicHistory::deleteSavedMessagesTopicHistory()
  : saved_messages_topic_id_()
{}

deleteSavedMessagesTopicHistory::deleteSavedMessagesTopicHistory(int53 saved_messages_topic_id_)
  : saved_messages_topic_id_(saved_messages_topic_id_)
{}

const std::int32_t deleteSavedMessagesTopicHistory::ID;

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

void deleteSavedMessagesTopicHistory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DeleteSavedMessagesTopicHistory");
    s.store_field("savedMessagesTopicId", saved_messages_topic_id_);
    s.store_class_end();
  }
}

deleteSavedMessagesTopicHistory::ReturnType deleteSavedMessagesTopicHistory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass discardCall::Class;
jfieldID discardCall::call_id_fieldID;
jfieldID discardCall::is_disconnected_fieldID;
jfieldID discardCall::invite_link_fieldID;
jfieldID discardCall::duration_fieldID;
jfieldID discardCall::is_video_fieldID;
jfieldID discardCall::connection_id_fieldID;

discardCall::discardCall()
  : call_id_()
  , is_disconnected_()
  , invite_link_()
  , duration_()
  , is_video_()
  , connection_id_()
{}

discardCall::discardCall(int32 call_id_, bool is_disconnected_, string const &invite_link_, int32 duration_, bool is_video_, int64 connection_id_)
  : call_id_(call_id_)
  , is_disconnected_(is_disconnected_)
  , invite_link_(invite_link_)
  , duration_(duration_)
  , is_video_(is_video_)
  , connection_id_(connection_id_)
{}

const std::int32_t discardCall::ID;

object_ptr<discardCall> discardCall::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<discardCall> res = make_object<discardCall>();
  res->call_id_ = env->GetIntField(p, res->call_id_fieldID);
  res->is_disconnected_ = (env->GetBooleanField(p, res->is_disconnected_fieldID) != 0);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->duration_ = env->GetIntField(p, res->duration_fieldID);
  res->is_video_ = (env->GetBooleanField(p, res->is_video_fieldID) != 0);
  res->connection_id_ = env->GetLongField(p, res->connection_id_fieldID);
  return res;
}

void discardCall::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "DiscardCall");
    s.store_field("callId", call_id_);
    s.store_field("isDisconnected", is_disconnected_);
    s.store_field("inviteLink", invite_link_);
    s.store_field("duration", duration_);
    s.store_field("isVideo", is_video_);
    s.store_field("connectionId", connection_id_);
    s.store_class_end();
  }
}

discardCall::ReturnType discardCall::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void discardCall::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$DiscardCall").c_str());
    call_id_fieldID = jni::get_field_id(env, Class, "callId", "I");
    is_disconnected_fieldID = jni::get_field_id(env, Class, "isDisconnected", "Z");
    invite_link_fieldID = jni::get_field_id(env, Class, "inviteLink", "Ljava/lang/String;");
    duration_fieldID = jni::get_field_id(env, Class, "duration", "I");
    is_video_fieldID = jni::get_field_id(env, Class, "isVideo", "Z");
    connection_id_fieldID = jni::get_field_id(env, Class, "connectionId", "J");
    return true;
  }();
  (void)is_inited;
}

jclass editBusinessStory::Class;
jfieldID editBusinessStory::story_poster_chat_id_fieldID;
jfieldID editBusinessStory::story_id_fieldID;
jfieldID editBusinessStory::content_fieldID;
jfieldID editBusinessStory::areas_fieldID;
jfieldID editBusinessStory::caption_fieldID;
jfieldID editBusinessStory::privacy_settings_fieldID;

editBusinessStory::editBusinessStory()
  : story_poster_chat_id_()
  , story_id_()
  , content_()
  , areas_()
  , caption_()
  , privacy_settings_()
{}

editBusinessStory::editBusinessStory(int53 story_poster_chat_id_, int32 story_id_, object_ptr<InputStoryContent> &&content_, object_ptr<inputStoryAreas> &&areas_, object_ptr<formattedText> &&caption_, object_ptr<StoryPrivacySettings> &&privacy_settings_)
  : story_poster_chat_id_(story_poster_chat_id_)
  , story_id_(story_id_)
  , content_(std::move(content_))
  , areas_(std::move(areas_))
  , caption_(std::move(caption_))
  , privacy_settings_(std::move(privacy_settings_))
{}

const std::int32_t editBusinessStory::ID;

object_ptr<editBusinessStory> editBusinessStory::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editBusinessStory> res = make_object<editBusinessStory>();
  res->story_poster_chat_id_ = env->GetLongField(p, res->story_poster_chat_id_fieldID);
  res->story_id_ = env->GetIntField(p, res->story_id_fieldID);
  res->content_ = jni::fetch_tl_object<InputStoryContent>(env, jni::fetch_object(env, p, res->content_fieldID));
  res->areas_ = jni::fetch_tl_object<inputStoryAreas>(env, jni::fetch_object(env, p, res->areas_fieldID));
  res->caption_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->caption_fieldID));
  res->privacy_settings_ = jni::fetch_tl_object<StoryPrivacySettings>(env, jni::fetch_object(env, p, res->privacy_settings_fieldID));
  return res;
}

void editBusinessStory::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditBusinessStory");
    s.store_field("storyPosterChatId", story_poster_chat_id_);
    s.store_field("storyId", story_id_);
    s.store_object_field("content", static_cast<const BaseObject *>(content_.get()));
    s.store_object_field("areas", static_cast<const BaseObject *>(areas_.get()));
    s.store_object_field("caption", static_cast<const BaseObject *>(caption_.get()));
    s.store_object_field("privacySettings", static_cast<const BaseObject *>(privacy_settings_.get()));
    s.store_class_end();
  }
}

editBusinessStory::ReturnType editBusinessStory::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return story::fetch(env, p);
}

void editBusinessStory::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditBusinessStory").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");
    content_fieldID = jni::get_field_id(env, Class, "content", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryContent;").c_str());
    areas_fieldID = jni::get_field_id(env, Class, "areas", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputStoryAreas;").c_str());
    caption_fieldID = jni::get_field_id(env, Class, "caption", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    privacy_settings_fieldID = jni::get_field_id(env, Class, "privacySettings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StoryPrivacySettings;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editChatInviteLink::Class;
jfieldID editChatInviteLink::chat_id_fieldID;
jfieldID editChatInviteLink::invite_link_fieldID;
jfieldID editChatInviteLink::name_fieldID;
jfieldID editChatInviteLink::expiration_date_fieldID;
jfieldID editChatInviteLink::member_limit_fieldID;
jfieldID editChatInviteLink::creates_join_request_fieldID;

editChatInviteLink::editChatInviteLink()
  : chat_id_()
  , invite_link_()
  , name_()
  , expiration_date_()
  , member_limit_()
  , creates_join_request_()
{}

editChatInviteLink::editChatInviteLink(int53 chat_id_, string const &invite_link_, string const &name_, int32 expiration_date_, int32 member_limit_, bool creates_join_request_)
  : chat_id_(chat_id_)
  , invite_link_(invite_link_)
  , name_(name_)
  , expiration_date_(expiration_date_)
  , member_limit_(member_limit_)
  , creates_join_request_(creates_join_request_)
{}

const std::int32_t editChatInviteLink::ID;

object_ptr<editChatInviteLink> editChatInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editChatInviteLink> res = make_object<editChatInviteLink>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->invite_link_ = jni::fetch_string(env, p, res->invite_link_fieldID);
  res->name_ = jni::fetch_string(env, p, res->name_fieldID);
  res->expiration_date_ = env->GetIntField(p, res->expiration_date_fieldID);
  res->member_limit_ = env->GetIntField(p, res->member_limit_fieldID);
  res->creates_join_request_ = (env->GetBooleanField(p, res->creates_join_request_fieldID) != 0);
  return res;
}

void editChatInviteLink::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditChatInviteLink");
    s.store_field("chatId", chat_id_);
    s.store_field("inviteLink", invite_link_);
    s.store_field("name", name_);
    s.store_field("expirationDate", expiration_date_);
    s.store_field("memberLimit", member_limit_);
    s.store_field("createsJoinRequest", creates_join_request_);
    s.store_class_end();
  }
}

editChatInviteLink::ReturnType editChatInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatInviteLink::fetch(env, p);
}

void editChatInviteLink::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditChatInviteLink").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;");
    name_fieldID = jni::get_field_id(env, Class, "name", "Ljava/lang/String;");
    expiration_date_fieldID = jni::get_field_id(env, Class, "expirationDate", "I");
    member_limit_fieldID = jni::get_field_id(env, Class, "memberLimit", "I");
    creates_join_request_fieldID = jni::get_field_id(env, Class, "createsJoinRequest", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass editInlineMessageReplyMarkup::Class;
jfieldID editInlineMessageReplyMarkup::inline_message_id_fieldID;
jfieldID editInlineMessageReplyMarkup::reply_markup_fieldID;

editInlineMessageReplyMarkup::editInlineMessageReplyMarkup()
  : inline_message_id_()
  , reply_markup_()
{}

editInlineMessageReplyMarkup::editInlineMessageReplyMarkup(string const &inline_message_id_, object_ptr<ReplyMarkup> &&reply_markup_)
  : inline_message_id_(inline_message_id_)
  , reply_markup_(std::move(reply_markup_))
{}

const std::int32_t editInlineMessageReplyMarkup::ID;

object_ptr<editInlineMessageReplyMarkup> editInlineMessageReplyMarkup::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editInlineMessageReplyMarkup> res = make_object<editInlineMessageReplyMarkup>();
  res->inline_message_id_ = jni::fetch_string(env, p, res->inline_message_id_fieldID);
  res->reply_markup_ = jni::fetch_tl_object<ReplyMarkup>(env, jni::fetch_object(env, p, res->reply_markup_fieldID));
  return res;
}

void editInlineMessageReplyMarkup::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditInlineMessageReplyMarkup");
    s.store_field("inlineMessageId", inline_message_id_);
    s.store_object_field("replyMarkup", static_cast<const BaseObject *>(reply_markup_.get()));
    s.store_class_end();
  }
}

editInlineMessageReplyMarkup::ReturnType editInlineMessageReplyMarkup::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editInlineMessageReplyMarkup::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditInlineMessageReplyMarkup").c_str());
    inline_message_id_fieldID = jni::get_field_id(env, Class, "inlineMessageId", "Ljava/lang/String;");
    reply_markup_fieldID = jni::get_field_id(env, Class, "replyMarkup", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ReplyMarkup;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass editQuickReplyMessage::Class;
jfieldID editQuickReplyMessage::shortcut_id_fieldID;
jfieldID editQuickReplyMessage::message_id_fieldID;
jfieldID editQuickReplyMessage::input_message_content_fieldID;

editQuickReplyMessage::editQuickReplyMessage()
  : shortcut_id_()
  , message_id_()
  , input_message_content_()
{}

editQuickReplyMessage::editQuickReplyMessage(int32 shortcut_id_, int53 message_id_, object_ptr<InputMessageContent> &&input_message_content_)
  : shortcut_id_(shortcut_id_)
  , message_id_(message_id_)
  , input_message_content_(std::move(input_message_content_))
{}

const std::int32_t editQuickReplyMessage::ID;

object_ptr<editQuickReplyMessage> editQuickReplyMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<editQuickReplyMessage> res = make_object<editQuickReplyMessage>();
  res->shortcut_id_ = env->GetIntField(p, res->shortcut_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->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 editQuickReplyMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "EditQuickReplyMessage");
    s.store_field("shortcutId", shortcut_id_);
    s.store_field("messageId", message_id_);
    s.store_object_field("inputMessageContent", static_cast<const BaseObject *>(input_message_content_.get()));
    s.store_class_end();
  }
}

editQuickReplyMessage::ReturnType editQuickReplyMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void editQuickReplyMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$EditQuickReplyMessage").c_str());
    shortcut_id_fieldID = jni::get_field_id(env, Class, "shortcutId", "I");
    message_id_fieldID = jni::get_field_id(env, Class, "messageId", "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 getArchiveChatListSettings::Class;

getArchiveChatListSettings::getArchiveChatListSettings() {
}

const std::int32_t getArchiveChatListSettings::ID;

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

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

getArchiveChatListSettings::ReturnType getArchiveChatListSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return archiveChatListSettings::fetch(env, p);
}

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

jclass getAvailableChatBoostSlots::Class;

getAvailableChatBoostSlots::getAvailableChatBoostSlots() {
}

const std::int32_t getAvailableChatBoostSlots::ID;

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

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

getAvailableChatBoostSlots::ReturnType getAvailableChatBoostSlots::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatBoostSlots::fetch(env, p);
}

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

jclass getBotInfoDescription::Class;
jfieldID getBotInfoDescription::bot_user_id_fieldID;
jfieldID getBotInfoDescription::language_code_fieldID;

getBotInfoDescription::getBotInfoDescription()
  : bot_user_id_()
  , language_code_()
{}

getBotInfoDescription::getBotInfoDescription(int53 bot_user_id_, string const &language_code_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
{}

const std::int32_t getBotInfoDescription::ID;

object_ptr<getBotInfoDescription> getBotInfoDescription::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getBotInfoDescription> res = make_object<getBotInfoDescription>();
  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 getBotInfoDescription::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBotInfoDescription");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    s.store_class_end();
  }
}

getBotInfoDescription::ReturnType getBotInfoDescription::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

getBusinessChatLinkInfo::getBusinessChatLinkInfo()
  : link_name_()
{}

getBusinessChatLinkInfo::getBusinessChatLinkInfo(string const &link_name_)
  : link_name_(link_name_)
{}

const std::int32_t getBusinessChatLinkInfo::ID;

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

void getBusinessChatLinkInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetBusinessChatLinkInfo");
    s.store_field("linkName", link_name_);
    s.store_class_end();
  }
}

getBusinessChatLinkInfo::ReturnType getBusinessChatLinkInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return businessChatLinkInfo::fetch(env, p);
}

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

jclass getChatAdministrators::Class;
jfieldID getChatAdministrators::chat_id_fieldID;

getChatAdministrators::getChatAdministrators()
  : chat_id_()
{}

getChatAdministrators::getChatAdministrators(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatAdministrators::ID;

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

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

getChatAdministrators::ReturnType getChatAdministrators::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatAdministrators::fetch(env, p);
}

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

jclass getChatBoostLink::Class;
jfieldID getChatBoostLink::chat_id_fieldID;

getChatBoostLink::getChatBoostLink()
  : chat_id_()
{}

getChatBoostLink::getChatBoostLink(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t getChatBoostLink::ID;

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

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

getChatBoostLink::ReturnType getChatBoostLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatBoostLink::fetch(env, p);
}

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

jclass getChatBoostLinkInfo::Class;
jfieldID getChatBoostLinkInfo::url_fieldID;

getChatBoostLinkInfo::getChatBoostLinkInfo()
  : url_()
{}

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

const std::int32_t getChatBoostLinkInfo::ID;

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

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

getChatBoostLinkInfo::ReturnType getChatBoostLinkInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatBoostLinkInfo::fetch(env, p);
}

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

jclass getChatsToPostStories::Class;

getChatsToPostStories::getChatsToPostStories() {
}

const std::int32_t getChatsToPostStories::ID;

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

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

getChatsToPostStories::ReturnType getChatsToPostStories::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getDefaultBackgroundCustomEmojiStickers::Class;

getDefaultBackgroundCustomEmojiStickers::getDefaultBackgroundCustomEmojiStickers() {
}

const std::int32_t getDefaultBackgroundCustomEmojiStickers::ID;

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

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

getDefaultBackgroundCustomEmojiStickers::ReturnType getDefaultBackgroundCustomEmojiStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

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

jclass getDefaultEmojiStatuses::Class;

getDefaultEmojiStatuses::getDefaultEmojiStatuses() {
}

const std::int32_t getDefaultEmojiStatuses::ID;

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

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

getDefaultEmojiStatuses::ReturnType getDefaultEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiStatusCustomEmojis::fetch(env, p);
}

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

jclass getDisallowedChatEmojiStatuses::Class;

getDisallowedChatEmojiStatuses::getDisallowedChatEmojiStatuses() {
}

const std::int32_t getDisallowedChatEmojiStatuses::ID;

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

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

getDisallowedChatEmojiStatuses::ReturnType getDisallowedChatEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiStatusCustomEmojis::fetch(env, p);
}

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

jclass getGiftAuctionAcquiredGifts::Class;
jfieldID getGiftAuctionAcquiredGifts::gift_id_fieldID;

getGiftAuctionAcquiredGifts::getGiftAuctionAcquiredGifts()
  : gift_id_()
{}

getGiftAuctionAcquiredGifts::getGiftAuctionAcquiredGifts(int64 gift_id_)
  : gift_id_(gift_id_)
{}

const std::int32_t getGiftAuctionAcquiredGifts::ID;

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

void getGiftAuctionAcquiredGifts::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetGiftAuctionAcquiredGifts");
    s.store_field("giftId", gift_id_);
    s.store_class_end();
  }
}

getGiftAuctionAcquiredGifts::ReturnType getGiftAuctionAcquiredGifts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return giftAuctionAcquiredGifts::fetch(env, p);
}

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

jclass getPasskeyParameters::Class;

getPasskeyParameters::getPasskeyParameters() {
}

const std::int32_t getPasskeyParameters::ID;

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

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

getPasskeyParameters::ReturnType getPasskeyParameters::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return text::fetch(env, p);
}

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

jclass getPassportAuthorizationFormAvailableElements::Class;
jfieldID getPassportAuthorizationFormAvailableElements::authorization_form_id_fieldID;
jfieldID getPassportAuthorizationFormAvailableElements::password_fieldID;

getPassportAuthorizationFormAvailableElements::getPassportAuthorizationFormAvailableElements()
  : authorization_form_id_()
  , password_()
{}

getPassportAuthorizationFormAvailableElements::getPassportAuthorizationFormAvailableElements(int32 authorization_form_id_, string const &password_)
  : authorization_form_id_(authorization_form_id_)
  , password_(password_)
{}

const std::int32_t getPassportAuthorizationFormAvailableElements::ID;

object_ptr<getPassportAuthorizationFormAvailableElements> getPassportAuthorizationFormAvailableElements::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPassportAuthorizationFormAvailableElements> res = make_object<getPassportAuthorizationFormAvailableElements>();
  res->authorization_form_id_ = env->GetIntField(p, res->authorization_form_id_fieldID);
  res->password_ = jni::fetch_string(env, p, res->password_fieldID);
  return res;
}

void getPassportAuthorizationFormAvailableElements::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPassportAuthorizationFormAvailableElements");
    s.store_field("authorizationFormId", authorization_form_id_);
    s.store_field("password", password_);
    s.store_class_end();
  }
}

getPassportAuthorizationFormAvailableElements::ReturnType getPassportAuthorizationFormAvailableElements::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passportElementsWithErrors::fetch(env, p);
}

void getPassportAuthorizationFormAvailableElements::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetPassportAuthorizationFormAvailableElements").c_str());
    authorization_form_id_fieldID = jni::get_field_id(env, Class, "authorizationFormId", "I");
    password_fieldID = jni::get_field_id(env, Class, "password", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass getPollVoters::Class;
jfieldID getPollVoters::chat_id_fieldID;
jfieldID getPollVoters::message_id_fieldID;
jfieldID getPollVoters::option_id_fieldID;
jfieldID getPollVoters::offset_fieldID;
jfieldID getPollVoters::limit_fieldID;

getPollVoters::getPollVoters()
  : chat_id_()
  , message_id_()
  , option_id_()
  , offset_()
  , limit_()
{}

getPollVoters::getPollVoters(int53 chat_id_, int53 message_id_, int32 option_id_, int32 offset_, int32 limit_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , option_id_(option_id_)
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getPollVoters::ID;

object_ptr<getPollVoters> getPollVoters::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getPollVoters> res = make_object<getPollVoters>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->option_id_ = env->GetIntField(p, res->option_id_fieldID);
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getPollVoters::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetPollVoters");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("optionId", option_id_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getPollVoters::ReturnType getPollVoters::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return pollVoters::fetch(env, p);
}

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

getRecentEmojiStatuses::getRecentEmojiStatuses() {
}

const std::int32_t getRecentEmojiStatuses::ID;

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

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

getRecentEmojiStatuses::ReturnType getRecentEmojiStatuses::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emojiStatuses::fetch(env, p);
}

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

jclass getRecentlyOpenedChats::Class;
jfieldID getRecentlyOpenedChats::limit_fieldID;

getRecentlyOpenedChats::getRecentlyOpenedChats()
  : limit_()
{}

getRecentlyOpenedChats::getRecentlyOpenedChats(int32 limit_)
  : limit_(limit_)
{}

const std::int32_t getRecentlyOpenedChats::ID;

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

void getRecentlyOpenedChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetRecentlyOpenedChats");
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getRecentlyOpenedChats::ReturnType getRecentlyOpenedChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getRecommendedChats::Class;

getRecommendedChats::getRecommendedChats() {
}

const std::int32_t getRecommendedChats::ID;

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

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

getRecommendedChats::ReturnType getRecommendedChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getScopeNotificationSettings::Class;
jfieldID getScopeNotificationSettings::scope_fieldID;

getScopeNotificationSettings::getScopeNotificationSettings()
  : scope_()
{}

getScopeNotificationSettings::getScopeNotificationSettings(object_ptr<NotificationSettingsScope> &&scope_)
  : scope_(std::move(scope_))
{}

const std::int32_t getScopeNotificationSettings::ID;

object_ptr<getScopeNotificationSettings> getScopeNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getScopeNotificationSettings> res = make_object<getScopeNotificationSettings>();
  res->scope_ = jni::fetch_tl_object<NotificationSettingsScope>(env, jni::fetch_object(env, p, res->scope_fieldID));
  return res;
}

void getScopeNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetScopeNotificationSettings");
    s.store_object_field("scope", static_cast<const BaseObject *>(scope_.get()));
    s.store_class_end();
  }
}

getScopeNotificationSettings::ReturnType getScopeNotificationSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return scopeNotificationSettings::fetch(env, p);
}

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

jclass getSearchSponsoredChats::Class;
jfieldID getSearchSponsoredChats::query_fieldID;

getSearchSponsoredChats::getSearchSponsoredChats()
  : query_()
{}

getSearchSponsoredChats::getSearchSponsoredChats(string const &query_)
  : query_(query_)
{}

const std::int32_t getSearchSponsoredChats::ID;

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

void getSearchSponsoredChats::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSearchSponsoredChats");
    s.store_field("query", query_);
    s.store_class_end();
  }
}

getSearchSponsoredChats::ReturnType getSearchSponsoredChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return sponsoredChats::fetch(env, p);
}

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

jclass getStarGiftPaymentOptions::Class;
jfieldID getStarGiftPaymentOptions::user_id_fieldID;

getStarGiftPaymentOptions::getStarGiftPaymentOptions()
  : user_id_()
{}

getStarGiftPaymentOptions::getStarGiftPaymentOptions(int53 user_id_)
  : user_id_(user_id_)
{}

const std::int32_t getStarGiftPaymentOptions::ID;

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

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

getStarGiftPaymentOptions::ReturnType getStarGiftPaymentOptions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return starPaymentOptions::fetch(env, p);
}

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

jclass getStatisticalGraph::Class;
jfieldID getStatisticalGraph::chat_id_fieldID;
jfieldID getStatisticalGraph::token_fieldID;
jfieldID getStatisticalGraph::x_fieldID;

getStatisticalGraph::getStatisticalGraph()
  : chat_id_()
  , token_()
  , x_()
{}

getStatisticalGraph::getStatisticalGraph(int53 chat_id_, string const &token_, int53 x_)
  : chat_id_(chat_id_)
  , token_(token_)
  , x_(x_)
{}

const std::int32_t getStatisticalGraph::ID;

object_ptr<getStatisticalGraph> getStatisticalGraph::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStatisticalGraph> res = make_object<getStatisticalGraph>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->token_ = jni::fetch_string(env, p, res->token_fieldID);
  res->x_ = env->GetLongField(p, res->x_fieldID);
  return res;
}

void getStatisticalGraph::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStatisticalGraph");
    s.store_field("chatId", chat_id_);
    s.store_field("token", token_);
    s.store_field("x", x_);
    s.store_class_end();
  }
}

getStatisticalGraph::ReturnType getStatisticalGraph::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return StatisticalGraph::fetch(env, p);
}

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

jclass getStickerOutline::Class;
jfieldID getStickerOutline::sticker_file_id_fieldID;
jfieldID getStickerOutline::for_animated_emoji_fieldID;
jfieldID getStickerOutline::for_clicked_animated_emoji_message_fieldID;

getStickerOutline::getStickerOutline()
  : sticker_file_id_()
  , for_animated_emoji_()
  , for_clicked_animated_emoji_message_()
{}

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

object_ptr<getStickerOutline> getStickerOutline::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getStickerOutline> res = make_object<getStickerOutline>();
  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 getStickerOutline::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetStickerOutline");
    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();
  }
}

getStickerOutline::ReturnType getStickerOutline::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return outline::fetch(env, p);
}

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

getSuitableDiscussionChats::getSuitableDiscussionChats() {
}

const std::int32_t getSuitableDiscussionChats::ID;

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

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

getSuitableDiscussionChats::ReturnType getSuitableDiscussionChats::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chats::fetch(env, p);
}

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

jclass getSupergroupMembers::Class;
jfieldID getSupergroupMembers::supergroup_id_fieldID;
jfieldID getSupergroupMembers::filter_fieldID;
jfieldID getSupergroupMembers::offset_fieldID;
jfieldID getSupergroupMembers::limit_fieldID;

getSupergroupMembers::getSupergroupMembers()
  : supergroup_id_()
  , filter_()
  , offset_()
  , limit_()
{}

getSupergroupMembers::getSupergroupMembers(int53 supergroup_id_, object_ptr<SupergroupMembersFilter> &&filter_, int32 offset_, int32 limit_)
  : supergroup_id_(supergroup_id_)
  , filter_(std::move(filter_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t getSupergroupMembers::ID;

object_ptr<getSupergroupMembers> getSupergroupMembers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getSupergroupMembers> res = make_object<getSupergroupMembers>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->filter_ = jni::fetch_tl_object<SupergroupMembersFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void getSupergroupMembers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "GetSupergroupMembers");
    s.store_field("supergroupId", supergroup_id_);
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

getSupergroupMembers::ReturnType getSupergroupMembers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return chatMembers::fetch(env, p);
}

void getSupergroupMembers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$GetSupergroupMembers").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SupergroupMembersFilter;").c_str());
    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 getVideoChatInviteLink::Class;
jfieldID getVideoChatInviteLink::group_call_id_fieldID;
jfieldID getVideoChatInviteLink::can_self_unmute_fieldID;

getVideoChatInviteLink::getVideoChatInviteLink()
  : group_call_id_()
  , can_self_unmute_()
{}

getVideoChatInviteLink::getVideoChatInviteLink(int32 group_call_id_, bool can_self_unmute_)
  : group_call_id_(group_call_id_)
  , can_self_unmute_(can_self_unmute_)
{}

const std::int32_t getVideoChatInviteLink::ID;

object_ptr<getVideoChatInviteLink> getVideoChatInviteLink::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<getVideoChatInviteLink> res = make_object<getVideoChatInviteLink>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->can_self_unmute_ = (env->GetBooleanField(p, res->can_self_unmute_fieldID) != 0);
  return res;
}

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

getVideoChatInviteLink::ReturnType getVideoChatInviteLink::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return httpUrl::fetch(env, p);
}

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

jclass importMessages::Class;
jfieldID importMessages::chat_id_fieldID;
jfieldID importMessages::message_file_fieldID;
jfieldID importMessages::attached_files_fieldID;

importMessages::importMessages()
  : chat_id_()
  , message_file_()
  , attached_files_()
{}

importMessages::importMessages(int53 chat_id_, object_ptr<InputFile> &&message_file_, array<object_ptr<InputFile>> &&attached_files_)
  : chat_id_(chat_id_)
  , message_file_(std::move(message_file_))
  , attached_files_(std::move(attached_files_))
{}

const std::int32_t importMessages::ID;

object_ptr<importMessages> importMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<importMessages> res = make_object<importMessages>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_file_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->message_file_fieldID));
  res->attached_files_ = jni::FetchVector<InputFile>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->attached_files_fieldID));
  return res;
}

void importMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ImportMessages");
    s.store_field("chatId", chat_id_);
    s.store_object_field("messageFile", static_cast<const BaseObject *>(message_file_.get()));
    { s.store_vector_begin("attachedFiles", attached_files_.size()); for (const auto &_value : attached_files_) { s.store_object_field("", static_cast<const BaseObject *>(_value.get())); } s.store_class_end(); }
    s.store_class_end();
  }
}

importMessages::ReturnType importMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void importMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ImportMessages").c_str());
    chat_id_fieldID = jni::get_field_id(env, Class, "chatId", "J");
    message_file_fieldID = jni::get_field_id(env, Class, "messageFile", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    attached_files_fieldID = jni::get_field_id(env, Class, "attachedFiles", (PSLICE() << "[L" << get_package_name_ref() << "/TdApi$InputFile;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass inviteGroupCallParticipant::Class;
jfieldID inviteGroupCallParticipant::group_call_id_fieldID;
jfieldID inviteGroupCallParticipant::user_id_fieldID;
jfieldID inviteGroupCallParticipant::is_video_fieldID;

inviteGroupCallParticipant::inviteGroupCallParticipant()
  : group_call_id_()
  , user_id_()
  , is_video_()
{}

inviteGroupCallParticipant::inviteGroupCallParticipant(int32 group_call_id_, int53 user_id_, bool is_video_)
  : group_call_id_(group_call_id_)
  , user_id_(user_id_)
  , is_video_(is_video_)
{}

const std::int32_t inviteGroupCallParticipant::ID;

object_ptr<inviteGroupCallParticipant> inviteGroupCallParticipant::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<inviteGroupCallParticipant> res = make_object<inviteGroupCallParticipant>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->is_video_ = (env->GetBooleanField(p, res->is_video_fieldID) != 0);
  return res;
}

void inviteGroupCallParticipant::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "InviteGroupCallParticipant");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("userId", user_id_);
    s.store_field("isVideo", is_video_);
    s.store_class_end();
  }
}

inviteGroupCallParticipant::ReturnType inviteGroupCallParticipant::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return InviteGroupCallParticipantResult::fetch(env, p);
}

void inviteGroupCallParticipant::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$InviteGroupCallParticipant").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    user_id_fieldID = jni::get_field_id(env, Class, "userId", "J");
    is_video_fieldID = jni::get_field_id(env, Class, "isVideo", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass inviteVideoChatParticipants::Class;
jfieldID inviteVideoChatParticipants::group_call_id_fieldID;
jfieldID inviteVideoChatParticipants::user_ids_fieldID;

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

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

const std::int32_t inviteVideoChatParticipants::ID;

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

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

inviteVideoChatParticipants::ReturnType inviteVideoChatParticipants::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass loadQuickReplyShortcuts::Class;

loadQuickReplyShortcuts::loadQuickReplyShortcuts() {
}

const std::int32_t loadQuickReplyShortcuts::ID;

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

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

loadQuickReplyShortcuts::ReturnType loadQuickReplyShortcuts::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass openBotSimilarBot::Class;
jfieldID openBotSimilarBot::bot_user_id_fieldID;
jfieldID openBotSimilarBot::opened_bot_user_id_fieldID;

openBotSimilarBot::openBotSimilarBot()
  : bot_user_id_()
  , opened_bot_user_id_()
{}

openBotSimilarBot::openBotSimilarBot(int53 bot_user_id_, int53 opened_bot_user_id_)
  : bot_user_id_(bot_user_id_)
  , opened_bot_user_id_(opened_bot_user_id_)
{}

const std::int32_t openBotSimilarBot::ID;

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

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

openBotSimilarBot::ReturnType openBotSimilarBot::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass pinChatMessage::Class;
jfieldID pinChatMessage::chat_id_fieldID;
jfieldID pinChatMessage::message_id_fieldID;
jfieldID pinChatMessage::disable_notification_fieldID;
jfieldID pinChatMessage::only_for_self_fieldID;

pinChatMessage::pinChatMessage()
  : chat_id_()
  , message_id_()
  , disable_notification_()
  , only_for_self_()
{}

pinChatMessage::pinChatMessage(int53 chat_id_, int53 message_id_, bool disable_notification_, bool only_for_self_)
  : chat_id_(chat_id_)
  , message_id_(message_id_)
  , disable_notification_(disable_notification_)
  , only_for_self_(only_for_self_)
{}

const std::int32_t pinChatMessage::ID;

object_ptr<pinChatMessage> pinChatMessage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<pinChatMessage> res = make_object<pinChatMessage>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->disable_notification_ = (env->GetBooleanField(p, res->disable_notification_fieldID) != 0);
  res->only_for_self_ = (env->GetBooleanField(p, res->only_for_self_fieldID) != 0);
  return res;
}

void pinChatMessage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "PinChatMessage");
    s.store_field("chatId", chat_id_);
    s.store_field("messageId", message_id_);
    s.store_field("disableNotification", disable_notification_);
    s.store_field("onlyForSelf", only_for_self_);
    s.store_class_end();
  }
}

pinChatMessage::ReturnType pinChatMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass processGiftPurchaseOffer::Class;
jfieldID processGiftPurchaseOffer::message_id_fieldID;
jfieldID processGiftPurchaseOffer::accept_fieldID;

processGiftPurchaseOffer::processGiftPurchaseOffer()
  : message_id_()
  , accept_()
{}

processGiftPurchaseOffer::processGiftPurchaseOffer(int53 message_id_, bool accept_)
  : message_id_(message_id_)
  , accept_(accept_)
{}

const std::int32_t processGiftPurchaseOffer::ID;

object_ptr<processGiftPurchaseOffer> processGiftPurchaseOffer::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<processGiftPurchaseOffer> res = make_object<processGiftPurchaseOffer>();
  res->message_id_ = env->GetLongField(p, res->message_id_fieldID);
  res->accept_ = (env->GetBooleanField(p, res->accept_fieldID) != 0);
  return res;
}

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

processGiftPurchaseOffer::ReturnType processGiftPurchaseOffer::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass readAllChatMentions::Class;
jfieldID readAllChatMentions::chat_id_fieldID;

readAllChatMentions::readAllChatMentions()
  : chat_id_()
{}

readAllChatMentions::readAllChatMentions(int53 chat_id_)
  : chat_id_(chat_id_)
{}

const std::int32_t readAllChatMentions::ID;

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

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

readAllChatMentions::ReturnType readAllChatMentions::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass readFilePart::Class;
jfieldID readFilePart::file_id_fieldID;
jfieldID readFilePart::offset_fieldID;
jfieldID readFilePart::count_fieldID;

readFilePart::readFilePart()
  : file_id_()
  , offset_()
  , count_()
{}

readFilePart::readFilePart(int32 file_id_, int53 offset_, int53 count_)
  : file_id_(file_id_)
  , offset_(offset_)
  , count_(count_)
{}

const std::int32_t readFilePart::ID;

object_ptr<readFilePart> readFilePart::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<readFilePart> res = make_object<readFilePart>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->offset_ = env->GetLongField(p, res->offset_fieldID);
  res->count_ = env->GetLongField(p, res->count_fieldID);
  return res;
}

void readFilePart::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReadFilePart");
    s.store_field("fileId", file_id_);
    s.store_field("offset", offset_);
    s.store_field("count", count_);
    s.store_class_end();
  }
}

readFilePart::ReturnType readFilePart::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return data::fetch(env, p);
}

void readFilePart::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReadFilePart").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "J");
    count_fieldID = jni::get_field_id(env, Class, "count", "J");
    return true;
  }();
  (void)is_inited;
}

jclass removeProxy::Class;
jfieldID removeProxy::proxy_id_fieldID;

removeProxy::removeProxy()
  : proxy_id_()
{}

removeProxy::removeProxy(int32 proxy_id_)
  : proxy_id_(proxy_id_)
{}

const std::int32_t removeProxy::ID;

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

void removeProxy::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveProxy");
    s.store_field("proxyId", proxy_id_);
    s.store_class_end();
  }
}

removeProxy::ReturnType removeProxy::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass removeSavedNotificationSound::Class;
jfieldID removeSavedNotificationSound::notification_sound_id_fieldID;

removeSavedNotificationSound::removeSavedNotificationSound()
  : notification_sound_id_()
{}

removeSavedNotificationSound::removeSavedNotificationSound(int64 notification_sound_id_)
  : notification_sound_id_(notification_sound_id_)
{}

const std::int32_t removeSavedNotificationSound::ID;

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

void removeSavedNotificationSound::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "RemoveSavedNotificationSound");
    s.store_field("notificationSoundId", notification_sound_id_);
    s.store_class_end();
  }
}

removeSavedNotificationSound::ReturnType removeSavedNotificationSound::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reorderInstalledStickerSets::Class;
jfieldID reorderInstalledStickerSets::sticker_type_fieldID;
jfieldID reorderInstalledStickerSets::sticker_set_ids_fieldID;

reorderInstalledStickerSets::reorderInstalledStickerSets()
  : sticker_type_()
  , sticker_set_ids_()
{}

reorderInstalledStickerSets::reorderInstalledStickerSets(object_ptr<StickerType> &&sticker_type_, array<int64> &&sticker_set_ids_)
  : sticker_type_(std::move(sticker_type_))
  , sticker_set_ids_(std::move(sticker_set_ids_))
{}

const std::int32_t reorderInstalledStickerSets::ID;

object_ptr<reorderInstalledStickerSets> reorderInstalledStickerSets::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderInstalledStickerSets> res = make_object<reorderInstalledStickerSets>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->sticker_set_ids_ = jni::fetch_vector(env, (jlongArray)jni::fetch_object(env, p, res->sticker_set_ids_fieldID));
  return res;
}

void reorderInstalledStickerSets::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderInstalledStickerSets");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    { 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();
  }
}

reorderInstalledStickerSets::ReturnType reorderInstalledStickerSets::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void reorderInstalledStickerSets::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ReorderInstalledStickerSets").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    sticker_set_ids_fieldID = jni::get_field_id(env, Class, "stickerSetIds", "[J");
    return true;
  }();
  (void)is_inited;
}

jclass reorderStoryAlbums::Class;
jfieldID reorderStoryAlbums::chat_id_fieldID;
jfieldID reorderStoryAlbums::story_album_ids_fieldID;

reorderStoryAlbums::reorderStoryAlbums()
  : chat_id_()
  , story_album_ids_()
{}

reorderStoryAlbums::reorderStoryAlbums(int53 chat_id_, array<int32> &&story_album_ids_)
  : chat_id_(chat_id_)
  , story_album_ids_(std::move(story_album_ids_))
{}

const std::int32_t reorderStoryAlbums::ID;

object_ptr<reorderStoryAlbums> reorderStoryAlbums::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderStoryAlbums> res = make_object<reorderStoryAlbums>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->story_album_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->story_album_ids_fieldID));
  return res;
}

void reorderStoryAlbums::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderStoryAlbums");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("storyAlbumIds", story_album_ids_.size()); for (const auto &_value : story_album_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

reorderStoryAlbums::ReturnType reorderStoryAlbums::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass reorderSupergroupActiveUsernames::Class;
jfieldID reorderSupergroupActiveUsernames::supergroup_id_fieldID;
jfieldID reorderSupergroupActiveUsernames::usernames_fieldID;

reorderSupergroupActiveUsernames::reorderSupergroupActiveUsernames()
  : supergroup_id_()
  , usernames_()
{}

reorderSupergroupActiveUsernames::reorderSupergroupActiveUsernames(int53 supergroup_id_, array<string> &&usernames_)
  : supergroup_id_(supergroup_id_)
  , usernames_(std::move(usernames_))
{}

const std::int32_t reorderSupergroupActiveUsernames::ID;

object_ptr<reorderSupergroupActiveUsernames> reorderSupergroupActiveUsernames::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<reorderSupergroupActiveUsernames> res = make_object<reorderSupergroupActiveUsernames>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->usernames_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->usernames_fieldID));
  return res;
}

void reorderSupergroupActiveUsernames::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ReorderSupergroupActiveUsernames");
    s.store_field("supergroupId", supergroup_id_);
    { s.store_vector_begin("usernames", usernames_.size()); for (const auto &_value : usernames_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

reorderSupergroupActiveUsernames::ReturnType reorderSupergroupActiveUsernames::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass resendRecoveryEmailAddressCode::Class;

resendRecoveryEmailAddressCode::resendRecoveryEmailAddressCode() {
}

const std::int32_t resendRecoveryEmailAddressCode::ID;

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

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

resendRecoveryEmailAddressCode::ReturnType resendRecoveryEmailAddressCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return passwordState::fetch(env, p);
}

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

jclass searchBackground::Class;
jfieldID searchBackground::name_fieldID;

searchBackground::searchBackground()
  : name_()
{}

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

const std::int32_t searchBackground::ID;

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

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

searchBackground::ReturnType searchBackground::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return background::fetch(env, p);
}

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

jclass searchMessages::Class;
jfieldID searchMessages::chat_list_fieldID;
jfieldID searchMessages::query_fieldID;
jfieldID searchMessages::offset_fieldID;
jfieldID searchMessages::limit_fieldID;
jfieldID searchMessages::filter_fieldID;
jfieldID searchMessages::chat_type_filter_fieldID;
jfieldID searchMessages::min_date_fieldID;
jfieldID searchMessages::max_date_fieldID;

searchMessages::searchMessages()
  : chat_list_()
  , query_()
  , offset_()
  , limit_()
  , filter_()
  , chat_type_filter_()
  , min_date_()
  , max_date_()
{}

searchMessages::searchMessages(object_ptr<ChatList> &&chat_list_, string const &query_, string const &offset_, int32 limit_, object_ptr<SearchMessagesFilter> &&filter_, object_ptr<SearchMessagesChatTypeFilter> &&chat_type_filter_, int32 min_date_, int32 max_date_)
  : chat_list_(std::move(chat_list_))
  , query_(query_)
  , offset_(offset_)
  , limit_(limit_)
  , filter_(std::move(filter_))
  , chat_type_filter_(std::move(chat_type_filter_))
  , min_date_(min_date_)
  , max_date_(max_date_)
{}

const std::int32_t searchMessages::ID;

object_ptr<searchMessages> searchMessages::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchMessages> res = make_object<searchMessages>();
  res->chat_list_ = jni::fetch_tl_object<ChatList>(env, jni::fetch_object(env, p, res->chat_list_fieldID));
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->offset_ = jni::fetch_string(env, p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  res->filter_ = jni::fetch_tl_object<SearchMessagesFilter>(env, jni::fetch_object(env, p, res->filter_fieldID));
  res->chat_type_filter_ = jni::fetch_tl_object<SearchMessagesChatTypeFilter>(env, jni::fetch_object(env, p, res->chat_type_filter_fieldID));
  res->min_date_ = env->GetIntField(p, res->min_date_fieldID);
  res->max_date_ = env->GetIntField(p, res->max_date_fieldID);
  return res;
}

void searchMessages::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchMessages");
    s.store_object_field("chatList", static_cast<const BaseObject *>(chat_list_.get()));
    s.store_field("query", query_);
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_object_field("filter", static_cast<const BaseObject *>(filter_.get()));
    s.store_object_field("chatTypeFilter", static_cast<const BaseObject *>(chat_type_filter_.get()));
    s.store_field("minDate", min_date_);
    s.store_field("maxDate", max_date_);
    s.store_class_end();
  }
}

searchMessages::ReturnType searchMessages::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundMessages::fetch(env, p);
}

void searchMessages::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchMessages").c_str());
    chat_list_fieldID = jni::get_field_id(env, Class, "chatList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$ChatList;").c_str());
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    offset_fieldID = jni::get_field_id(env, Class, "offset", "Ljava/lang/String;");
    limit_fieldID = jni::get_field_id(env, Class, "limit", "I");
    filter_fieldID = jni::get_field_id(env, Class, "filter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SearchMessagesFilter;").c_str());
    chat_type_filter_fieldID = jni::get_field_id(env, Class, "chatTypeFilter", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$SearchMessagesChatTypeFilter;").c_str());
    min_date_fieldID = jni::get_field_id(env, Class, "minDate", "I");
    max_date_fieldID = jni::get_field_id(env, Class, "maxDate", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchQuote::Class;
jfieldID searchQuote::text_fieldID;
jfieldID searchQuote::quote_fieldID;
jfieldID searchQuote::quote_position_fieldID;

searchQuote::searchQuote()
  : text_()
  , quote_()
  , quote_position_()
{}

searchQuote::searchQuote(object_ptr<formattedText> &&text_, object_ptr<formattedText> &&quote_, int32 quote_position_)
  : text_(std::move(text_))
  , quote_(std::move(quote_))
  , quote_position_(quote_position_)
{}

const std::int32_t searchQuote::ID;

object_ptr<searchQuote> searchQuote::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchQuote> res = make_object<searchQuote>();
  res->text_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->text_fieldID));
  res->quote_ = jni::fetch_tl_object<formattedText>(env, jni::fetch_object(env, p, res->quote_fieldID));
  res->quote_position_ = env->GetIntField(p, res->quote_position_fieldID);
  return res;
}

void searchQuote::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchQuote");
    s.store_object_field("text", static_cast<const BaseObject *>(text_.get()));
    s.store_object_field("quote", static_cast<const BaseObject *>(quote_.get()));
    s.store_field("quotePosition", quote_position_);
    s.store_class_end();
  }
}

searchQuote::ReturnType searchQuote::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return foundPosition::fetch(env, p);
}

void searchQuote::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchQuote").c_str());
    text_fieldID = jni::get_field_id(env, Class, "text", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    quote_fieldID = jni::get_field_id(env, Class, "quote", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$FormattedText;").c_str());
    quote_position_fieldID = jni::get_field_id(env, Class, "quotePosition", "I");
    return true;
  }();
  (void)is_inited;
}

jclass searchStickers::Class;
jfieldID searchStickers::sticker_type_fieldID;
jfieldID searchStickers::emojis_fieldID;
jfieldID searchStickers::query_fieldID;
jfieldID searchStickers::input_language_codes_fieldID;
jfieldID searchStickers::offset_fieldID;
jfieldID searchStickers::limit_fieldID;

searchStickers::searchStickers()
  : sticker_type_()
  , emojis_()
  , query_()
  , input_language_codes_()
  , offset_()
  , limit_()
{}

searchStickers::searchStickers(object_ptr<StickerType> &&sticker_type_, string const &emojis_, string const &query_, array<string> &&input_language_codes_, int32 offset_, int32 limit_)
  : sticker_type_(std::move(sticker_type_))
  , emojis_(emojis_)
  , query_(query_)
  , input_language_codes_(std::move(input_language_codes_))
  , offset_(offset_)
  , limit_(limit_)
{}

const std::int32_t searchStickers::ID;

object_ptr<searchStickers> searchStickers::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<searchStickers> res = make_object<searchStickers>();
  res->sticker_type_ = jni::fetch_tl_object<StickerType>(env, jni::fetch_object(env, p, res->sticker_type_fieldID));
  res->emojis_ = jni::fetch_string(env, p, res->emojis_fieldID);
  res->query_ = jni::fetch_string(env, p, res->query_fieldID);
  res->input_language_codes_ = jni::FetchVector<string>::fetch(env, (jobjectArray)jni::fetch_object(env, p, res->input_language_codes_fieldID));
  res->offset_ = env->GetIntField(p, res->offset_fieldID);
  res->limit_ = env->GetIntField(p, res->limit_fieldID);
  return res;
}

void searchStickers::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SearchStickers");
    s.store_object_field("stickerType", static_cast<const BaseObject *>(sticker_type_.get()));
    s.store_field("emojis", emojis_);
    s.store_field("query", query_);
    { s.store_vector_begin("inputLanguageCodes", input_language_codes_.size()); for (const auto &_value : input_language_codes_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_field("offset", offset_);
    s.store_field("limit", limit_);
    s.store_class_end();
  }
}

searchStickers::ReturnType searchStickers::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return stickers::fetch(env, p);
}

void searchStickers::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SearchStickers").c_str());
    sticker_type_fieldID = jni::get_field_id(env, Class, "stickerType", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$StickerType;").c_str());
    emojis_fieldID = jni::get_field_id(env, Class, "emojis", "Ljava/lang/String;");
    query_fieldID = jni::get_field_id(env, Class, "query", "Ljava/lang/String;");
    input_language_codes_fieldID = jni::get_field_id(env, Class, "inputLanguageCodes", "[Ljava/lang/String;");
    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 sendEmailAddressVerificationCode::Class;
jfieldID sendEmailAddressVerificationCode::email_address_fieldID;

sendEmailAddressVerificationCode::sendEmailAddressVerificationCode()
  : email_address_()
{}

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

const std::int32_t sendEmailAddressVerificationCode::ID;

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

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

sendEmailAddressVerificationCode::ReturnType sendEmailAddressVerificationCode::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emailAddressAuthenticationCodeInfo::fetch(env, p);
}

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

jclass setAutoDownloadSettings::Class;
jfieldID setAutoDownloadSettings::settings_fieldID;
jfieldID setAutoDownloadSettings::type_fieldID;

setAutoDownloadSettings::setAutoDownloadSettings()
  : settings_()
  , type_()
{}

setAutoDownloadSettings::setAutoDownloadSettings(object_ptr<autoDownloadSettings> &&settings_, object_ptr<NetworkType> &&type_)
  : settings_(std::move(settings_))
  , type_(std::move(type_))
{}

const std::int32_t setAutoDownloadSettings::ID;

object_ptr<setAutoDownloadSettings> setAutoDownloadSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setAutoDownloadSettings> res = make_object<setAutoDownloadSettings>();
  res->settings_ = jni::fetch_tl_object<autoDownloadSettings>(env, jni::fetch_object(env, p, res->settings_fieldID));
  res->type_ = jni::fetch_tl_object<NetworkType>(env, jni::fetch_object(env, p, res->type_fieldID));
  return res;
}

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

setAutoDownloadSettings::ReturnType setAutoDownloadSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setAutoDownloadSettings::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetAutoDownloadSettings").c_str());
    settings_fieldID = jni::get_field_id(env, Class, "settings", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$AutoDownloadSettings;").c_str());
    type_fieldID = jni::get_field_id(env, Class, "type", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$NetworkType;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setBirthdate::Class;
jfieldID setBirthdate::birthdate_fieldID;

setBirthdate::setBirthdate()
  : birthdate_()
{}

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

const std::int32_t setBirthdate::ID;

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

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

setBirthdate::ReturnType setBirthdate::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setBotName::Class;
jfieldID setBotName::bot_user_id_fieldID;
jfieldID setBotName::language_code_fieldID;
jfieldID setBotName::name_fieldID;

setBotName::setBotName()
  : bot_user_id_()
  , language_code_()
  , name_()
{}

setBotName::setBotName(int53 bot_user_id_, string const &language_code_, string const &name_)
  : bot_user_id_(bot_user_id_)
  , language_code_(language_code_)
  , name_(name_)
{}

const std::int32_t setBotName::ID;

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

void setBotName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBotName");
    s.store_field("botUserId", bot_user_id_);
    s.store_field("languageCode", language_code_);
    s.store_field("name", name_);
    s.store_class_end();
  }
}

setBotName::ReturnType setBotName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setBusinessAccountName::Class;
jfieldID setBusinessAccountName::business_connection_id_fieldID;
jfieldID setBusinessAccountName::first_name_fieldID;
jfieldID setBusinessAccountName::last_name_fieldID;

setBusinessAccountName::setBusinessAccountName()
  : business_connection_id_()
  , first_name_()
  , last_name_()
{}

setBusinessAccountName::setBusinessAccountName(string const &business_connection_id_, string const &first_name_, string const &last_name_)
  : business_connection_id_(business_connection_id_)
  , first_name_(first_name_)
  , last_name_(last_name_)
{}

const std::int32_t setBusinessAccountName::ID;

object_ptr<setBusinessAccountName> setBusinessAccountName::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessAccountName> res = make_object<setBusinessAccountName>();
  res->business_connection_id_ = jni::fetch_string(env, p, res->business_connection_id_fieldID);
  res->first_name_ = jni::fetch_string(env, p, res->first_name_fieldID);
  res->last_name_ = jni::fetch_string(env, p, res->last_name_fieldID);
  return res;
}

void setBusinessAccountName::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessAccountName");
    s.store_field("businessConnectionId", business_connection_id_);
    s.store_field("firstName", first_name_);
    s.store_field("lastName", last_name_);
    s.store_class_end();
  }
}

setBusinessAccountName::ReturnType setBusinessAccountName::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setBusinessAccountName::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetBusinessAccountName").c_str());
    business_connection_id_fieldID = jni::get_field_id(env, Class, "businessConnectionId", "Ljava/lang/String;");
    first_name_fieldID = jni::get_field_id(env, Class, "firstName", "Ljava/lang/String;");
    last_name_fieldID = jni::get_field_id(env, Class, "lastName", "Ljava/lang/String;");
    return true;
  }();
  (void)is_inited;
}

jclass setBusinessStartPage::Class;
jfieldID setBusinessStartPage::start_page_fieldID;

setBusinessStartPage::setBusinessStartPage()
  : start_page_()
{}

setBusinessStartPage::setBusinessStartPage(object_ptr<inputBusinessStartPage> &&start_page_)
  : start_page_(std::move(start_page_))
{}

const std::int32_t setBusinessStartPage::ID;

object_ptr<setBusinessStartPage> setBusinessStartPage::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setBusinessStartPage> res = make_object<setBusinessStartPage>();
  res->start_page_ = jni::fetch_tl_object<inputBusinessStartPage>(env, jni::fetch_object(env, p, res->start_page_fieldID));
  return res;
}

void setBusinessStartPage::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetBusinessStartPage");
    s.store_object_field("startPage", static_cast<const BaseObject *>(start_page_.get()));
    s.store_class_end();
  }
}

setBusinessStartPage::ReturnType setBusinessStartPage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatMemberTag::Class;
jfieldID setChatMemberTag::chat_id_fieldID;
jfieldID setChatMemberTag::user_id_fieldID;
jfieldID setChatMemberTag::tag_fieldID;

setChatMemberTag::setChatMemberTag()
  : chat_id_()
  , user_id_()
  , tag_()
{}

setChatMemberTag::setChatMemberTag(int53 chat_id_, int53 user_id_, string const &tag_)
  : chat_id_(chat_id_)
  , user_id_(user_id_)
  , tag_(tag_)
{}

const std::int32_t setChatMemberTag::ID;

object_ptr<setChatMemberTag> setChatMemberTag::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatMemberTag> res = make_object<setChatMemberTag>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->user_id_ = env->GetLongField(p, res->user_id_fieldID);
  res->tag_ = jni::fetch_string(env, p, res->tag_fieldID);
  return res;
}

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

setChatMemberTag::ReturnType setChatMemberTag::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setChatNotificationSettings::Class;
jfieldID setChatNotificationSettings::chat_id_fieldID;
jfieldID setChatNotificationSettings::notification_settings_fieldID;

setChatNotificationSettings::setChatNotificationSettings()
  : chat_id_()
  , notification_settings_()
{}

setChatNotificationSettings::setChatNotificationSettings(int53 chat_id_, object_ptr<chatNotificationSettings> &&notification_settings_)
  : chat_id_(chat_id_)
  , notification_settings_(std::move(notification_settings_))
{}

const std::int32_t setChatNotificationSettings::ID;

object_ptr<setChatNotificationSettings> setChatNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setChatNotificationSettings> res = make_object<setChatNotificationSettings>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->notification_settings_ = jni::fetch_tl_object<chatNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  return res;
}

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

setChatNotificationSettings::ReturnType setChatNotificationSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setDefaultReactionType::Class;
jfieldID setDefaultReactionType::reaction_type_fieldID;

setDefaultReactionType::setDefaultReactionType()
  : reaction_type_()
{}

setDefaultReactionType::setDefaultReactionType(object_ptr<ReactionType> &&reaction_type_)
  : reaction_type_(std::move(reaction_type_))
{}

const std::int32_t setDefaultReactionType::ID;

object_ptr<setDefaultReactionType> setDefaultReactionType::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setDefaultReactionType> res = make_object<setDefaultReactionType>();
  res->reaction_type_ = jni::fetch_tl_object<ReactionType>(env, jni::fetch_object(env, p, res->reaction_type_fieldID));
  return res;
}

void setDefaultReactionType::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetDefaultReactionType");
    s.store_object_field("reactionType", static_cast<const BaseObject *>(reaction_type_.get()));
    s.store_class_end();
  }
}

setDefaultReactionType::ReturnType setDefaultReactionType::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setForumTopicNotificationSettings::Class;
jfieldID setForumTopicNotificationSettings::chat_id_fieldID;
jfieldID setForumTopicNotificationSettings::forum_topic_id_fieldID;
jfieldID setForumTopicNotificationSettings::notification_settings_fieldID;

setForumTopicNotificationSettings::setForumTopicNotificationSettings()
  : chat_id_()
  , forum_topic_id_()
  , notification_settings_()
{}

setForumTopicNotificationSettings::setForumTopicNotificationSettings(int53 chat_id_, int32 forum_topic_id_, object_ptr<chatNotificationSettings> &&notification_settings_)
  : chat_id_(chat_id_)
  , forum_topic_id_(forum_topic_id_)
  , notification_settings_(std::move(notification_settings_))
{}

const std::int32_t setForumTopicNotificationSettings::ID;

object_ptr<setForumTopicNotificationSettings> setForumTopicNotificationSettings::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setForumTopicNotificationSettings> res = make_object<setForumTopicNotificationSettings>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_id_ = env->GetIntField(p, res->forum_topic_id_fieldID);
  res->notification_settings_ = jni::fetch_tl_object<chatNotificationSettings>(env, jni::fetch_object(env, p, res->notification_settings_fieldID));
  return res;
}

void setForumTopicNotificationSettings::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetForumTopicNotificationSettings");
    s.store_field("chatId", chat_id_);
    s.store_field("forumTopicId", forum_topic_id_);
    s.store_object_field("notificationSettings", static_cast<const BaseObject *>(notification_settings_.get()));
    s.store_class_end();
  }
}

setForumTopicNotificationSettings::ReturnType setForumTopicNotificationSettings::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setLiveStoryMessageSender::Class;
jfieldID setLiveStoryMessageSender::group_call_id_fieldID;
jfieldID setLiveStoryMessageSender::message_sender_id_fieldID;

setLiveStoryMessageSender::setLiveStoryMessageSender()
  : group_call_id_()
  , message_sender_id_()
{}

setLiveStoryMessageSender::setLiveStoryMessageSender(int32 group_call_id_, object_ptr<MessageSender> &&message_sender_id_)
  : group_call_id_(group_call_id_)
  , message_sender_id_(std::move(message_sender_id_))
{}

const std::int32_t setLiveStoryMessageSender::ID;

object_ptr<setLiveStoryMessageSender> setLiveStoryMessageSender::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setLiveStoryMessageSender> res = make_object<setLiveStoryMessageSender>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->message_sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->message_sender_id_fieldID));
  return res;
}

void setLiveStoryMessageSender::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetLiveStoryMessageSender");
    s.store_field("groupCallId", group_call_id_);
    s.store_object_field("messageSenderId", static_cast<const BaseObject *>(message_sender_id_.get()));
    s.store_class_end();
  }
}

setLiveStoryMessageSender::ReturnType setLiveStoryMessageSender::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setLogTagVerbosityLevel::Class;
jfieldID setLogTagVerbosityLevel::tag_fieldID;
jfieldID setLogTagVerbosityLevel::new_verbosity_level_fieldID;

setLogTagVerbosityLevel::setLogTagVerbosityLevel()
  : tag_()
  , new_verbosity_level_()
{}

setLogTagVerbosityLevel::setLogTagVerbosityLevel(string const &tag_, int32 new_verbosity_level_)
  : tag_(tag_)
  , new_verbosity_level_(new_verbosity_level_)
{}

const std::int32_t setLogTagVerbosityLevel::ID;

object_ptr<setLogTagVerbosityLevel> setLogTagVerbosityLevel::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setLogTagVerbosityLevel> res = make_object<setLogTagVerbosityLevel>();
  res->tag_ = jni::fetch_string(env, p, res->tag_fieldID);
  res->new_verbosity_level_ = env->GetIntField(p, res->new_verbosity_level_fieldID);
  return res;
}

void setLogTagVerbosityLevel::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetLogTagVerbosityLevel");
    s.store_field("tag", tag_);
    s.store_field("newVerbosityLevel", new_verbosity_level_);
    s.store_class_end();
  }
}

setLogTagVerbosityLevel::ReturnType setLogTagVerbosityLevel::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setLogTagVerbosityLevel::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetLogTagVerbosityLevel").c_str());
    tag_fieldID = jni::get_field_id(env, Class, "tag", "Ljava/lang/String;");
    new_verbosity_level_fieldID = jni::get_field_id(env, Class, "newVerbosityLevel", "I");
    return true;
  }();
  (void)is_inited;
}

jclass setLoginEmailAddress::Class;
jfieldID setLoginEmailAddress::new_login_email_address_fieldID;

setLoginEmailAddress::setLoginEmailAddress()
  : new_login_email_address_()
{}

setLoginEmailAddress::setLoginEmailAddress(string const &new_login_email_address_)
  : new_login_email_address_(new_login_email_address_)
{}

const std::int32_t setLoginEmailAddress::ID;

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

void setLoginEmailAddress::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetLoginEmailAddress");
    s.store_field("newLoginEmailAddress", new_login_email_address_);
    s.store_class_end();
  }
}

setLoginEmailAddress::ReturnType setLoginEmailAddress::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return emailAddressAuthenticationCodeInfo::fetch(env, p);
}

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

jclass setMessageSenderBlockList::Class;
jfieldID setMessageSenderBlockList::sender_id_fieldID;
jfieldID setMessageSenderBlockList::block_list_fieldID;

setMessageSenderBlockList::setMessageSenderBlockList()
  : sender_id_()
  , block_list_()
{}

setMessageSenderBlockList::setMessageSenderBlockList(object_ptr<MessageSender> &&sender_id_, object_ptr<BlockList> &&block_list_)
  : sender_id_(std::move(sender_id_))
  , block_list_(std::move(block_list_))
{}

const std::int32_t setMessageSenderBlockList::ID;

object_ptr<setMessageSenderBlockList> setMessageSenderBlockList::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setMessageSenderBlockList> res = make_object<setMessageSenderBlockList>();
  res->sender_id_ = jni::fetch_tl_object<MessageSender>(env, jni::fetch_object(env, p, res->sender_id_fieldID));
  res->block_list_ = jni::fetch_tl_object<BlockList>(env, jni::fetch_object(env, p, res->block_list_fieldID));
  return res;
}

void setMessageSenderBlockList::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetMessageSenderBlockList");
    s.store_object_field("senderId", static_cast<const BaseObject *>(sender_id_.get()));
    s.store_object_field("blockList", static_cast<const BaseObject *>(block_list_.get()));
    s.store_class_end();
  }
}

setMessageSenderBlockList::ReturnType setMessageSenderBlockList::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void setMessageSenderBlockList::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$SetMessageSenderBlockList").c_str());
    sender_id_fieldID = jni::get_field_id(env, Class, "senderId", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$MessageSender;").c_str());
    block_list_fieldID = jni::get_field_id(env, Class, "blockList", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$BlockList;").c_str());
    return true;
  }();
  (void)is_inited;
}

jclass setPinnedForumTopics::Class;
jfieldID setPinnedForumTopics::chat_id_fieldID;
jfieldID setPinnedForumTopics::forum_topic_ids_fieldID;

setPinnedForumTopics::setPinnedForumTopics()
  : chat_id_()
  , forum_topic_ids_()
{}

setPinnedForumTopics::setPinnedForumTopics(int53 chat_id_, array<int32> &&forum_topic_ids_)
  : chat_id_(chat_id_)
  , forum_topic_ids_(std::move(forum_topic_ids_))
{}

const std::int32_t setPinnedForumTopics::ID;

object_ptr<setPinnedForumTopics> setPinnedForumTopics::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setPinnedForumTopics> res = make_object<setPinnedForumTopics>();
  res->chat_id_ = env->GetLongField(p, res->chat_id_fieldID);
  res->forum_topic_ids_ = jni::fetch_vector(env, (jintArray)jni::fetch_object(env, p, res->forum_topic_ids_fieldID));
  return res;
}

void setPinnedForumTopics::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetPinnedForumTopics");
    s.store_field("chatId", chat_id_);
    { s.store_vector_begin("forumTopicIds", forum_topic_ids_.size()); for (const auto &_value : forum_topic_ids_) { s.store_field("", _value); } s.store_class_end(); }
    s.store_class_end();
  }
}

setPinnedForumTopics::ReturnType setPinnedForumTopics::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setStickerMaskPosition::Class;
jfieldID setStickerMaskPosition::sticker_fieldID;
jfieldID setStickerMaskPosition::mask_position_fieldID;

setStickerMaskPosition::setStickerMaskPosition()
  : sticker_()
  , mask_position_()
{}

setStickerMaskPosition::setStickerMaskPosition(object_ptr<InputFile> &&sticker_, object_ptr<maskPosition> &&mask_position_)
  : sticker_(std::move(sticker_))
  , mask_position_(std::move(mask_position_))
{}

const std::int32_t setStickerMaskPosition::ID;

object_ptr<setStickerMaskPosition> setStickerMaskPosition::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<setStickerMaskPosition> res = make_object<setStickerMaskPosition>();
  res->sticker_ = jni::fetch_tl_object<InputFile>(env, jni::fetch_object(env, p, res->sticker_fieldID));
  res->mask_position_ = jni::fetch_tl_object<maskPosition>(env, jni::fetch_object(env, p, res->mask_position_fieldID));
  return res;
}

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

setStickerMaskPosition::ReturnType setStickerMaskPosition::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass setUsername::Class;
jfieldID setUsername::username_fieldID;

setUsername::setUsername()
  : username_()
{}

setUsername::setUsername(string const &username_)
  : username_(username_)
{}

const std::int32_t setUsername::ID;

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

void setUsername::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "SetUsername");
    s.store_field("username", username_);
    s.store_class_end();
  }
}

setUsername::ReturnType setUsername::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass startGroupCallRecording::Class;
jfieldID startGroupCallRecording::group_call_id_fieldID;
jfieldID startGroupCallRecording::title_fieldID;
jfieldID startGroupCallRecording::record_video_fieldID;
jfieldID startGroupCallRecording::use_portrait_orientation_fieldID;

startGroupCallRecording::startGroupCallRecording()
  : group_call_id_()
  , title_()
  , record_video_()
  , use_portrait_orientation_()
{}

startGroupCallRecording::startGroupCallRecording(int32 group_call_id_, string const &title_, bool record_video_, bool use_portrait_orientation_)
  : group_call_id_(group_call_id_)
  , title_(title_)
  , record_video_(record_video_)
  , use_portrait_orientation_(use_portrait_orientation_)
{}

const std::int32_t startGroupCallRecording::ID;

object_ptr<startGroupCallRecording> startGroupCallRecording::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<startGroupCallRecording> res = make_object<startGroupCallRecording>();
  res->group_call_id_ = env->GetIntField(p, res->group_call_id_fieldID);
  res->title_ = jni::fetch_string(env, p, res->title_fieldID);
  res->record_video_ = (env->GetBooleanField(p, res->record_video_fieldID) != 0);
  res->use_portrait_orientation_ = (env->GetBooleanField(p, res->use_portrait_orientation_fieldID) != 0);
  return res;
}

void startGroupCallRecording::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "StartGroupCallRecording");
    s.store_field("groupCallId", group_call_id_);
    s.store_field("title", title_);
    s.store_field("recordVideo", record_video_);
    s.store_field("usePortraitOrientation", use_portrait_orientation_);
    s.store_class_end();
  }
}

startGroupCallRecording::ReturnType startGroupCallRecording::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void startGroupCallRecording::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$StartGroupCallRecording").c_str());
    group_call_id_fieldID = jni::get_field_id(env, Class, "groupCallId", "I");
    title_fieldID = jni::get_field_id(env, Class, "title", "Ljava/lang/String;");
    record_video_fieldID = jni::get_field_id(env, Class, "recordVideo", "Z");
    use_portrait_orientation_fieldID = jni::get_field_id(env, Class, "usePortraitOrientation", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleChatHasProtectedContent::Class;
jfieldID toggleChatHasProtectedContent::chat_id_fieldID;
jfieldID toggleChatHasProtectedContent::has_protected_content_fieldID;

toggleChatHasProtectedContent::toggleChatHasProtectedContent()
  : chat_id_()
  , has_protected_content_()
{}

toggleChatHasProtectedContent::toggleChatHasProtectedContent(int53 chat_id_, bool has_protected_content_)
  : chat_id_(chat_id_)
  , has_protected_content_(has_protected_content_)
{}

const std::int32_t toggleChatHasProtectedContent::ID;

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

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

toggleChatHasProtectedContent::ReturnType toggleChatHasProtectedContent::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleDownloadIsPaused::Class;
jfieldID toggleDownloadIsPaused::file_id_fieldID;
jfieldID toggleDownloadIsPaused::is_paused_fieldID;

toggleDownloadIsPaused::toggleDownloadIsPaused()
  : file_id_()
  , is_paused_()
{}

toggleDownloadIsPaused::toggleDownloadIsPaused(int32 file_id_, bool is_paused_)
  : file_id_(file_id_)
  , is_paused_(is_paused_)
{}

const std::int32_t toggleDownloadIsPaused::ID;

object_ptr<toggleDownloadIsPaused> toggleDownloadIsPaused::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleDownloadIsPaused> res = make_object<toggleDownloadIsPaused>();
  res->file_id_ = env->GetIntField(p, res->file_id_fieldID);
  res->is_paused_ = (env->GetBooleanField(p, res->is_paused_fieldID) != 0);
  return res;
}

void toggleDownloadIsPaused::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleDownloadIsPaused");
    s.store_field("fileId", file_id_);
    s.store_field("isPaused", is_paused_);
    s.store_class_end();
  }
}

toggleDownloadIsPaused::ReturnType toggleDownloadIsPaused::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleDownloadIsPaused::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleDownloadIsPaused").c_str());
    file_id_fieldID = jni::get_field_id(env, Class, "fileId", "I");
    is_paused_fieldID = jni::get_field_id(env, Class, "isPaused", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass toggleHasSponsoredMessagesEnabled::Class;
jfieldID toggleHasSponsoredMessagesEnabled::has_sponsored_messages_enabled_fieldID;

toggleHasSponsoredMessagesEnabled::toggleHasSponsoredMessagesEnabled()
  : has_sponsored_messages_enabled_()
{}

toggleHasSponsoredMessagesEnabled::toggleHasSponsoredMessagesEnabled(bool has_sponsored_messages_enabled_)
  : has_sponsored_messages_enabled_(has_sponsored_messages_enabled_)
{}

const std::int32_t toggleHasSponsoredMessagesEnabled::ID;

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

void toggleHasSponsoredMessagesEnabled::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleHasSponsoredMessagesEnabled");
    s.store_field("hasSponsoredMessagesEnabled", has_sponsored_messages_enabled_);
    s.store_class_end();
  }
}

toggleHasSponsoredMessagesEnabled::ReturnType toggleHasSponsoredMessagesEnabled::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

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

jclass toggleSupergroupUsernameIsActive::Class;
jfieldID toggleSupergroupUsernameIsActive::supergroup_id_fieldID;
jfieldID toggleSupergroupUsernameIsActive::username_fieldID;
jfieldID toggleSupergroupUsernameIsActive::is_active_fieldID;

toggleSupergroupUsernameIsActive::toggleSupergroupUsernameIsActive()
  : supergroup_id_()
  , username_()
  , is_active_()
{}

toggleSupergroupUsernameIsActive::toggleSupergroupUsernameIsActive(int53 supergroup_id_, string const &username_, bool is_active_)
  : supergroup_id_(supergroup_id_)
  , username_(username_)
  , is_active_(is_active_)
{}

const std::int32_t toggleSupergroupUsernameIsActive::ID;

object_ptr<toggleSupergroupUsernameIsActive> toggleSupergroupUsernameIsActive::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<toggleSupergroupUsernameIsActive> res = make_object<toggleSupergroupUsernameIsActive>();
  res->supergroup_id_ = env->GetLongField(p, res->supergroup_id_fieldID);
  res->username_ = jni::fetch_string(env, p, res->username_fieldID);
  res->is_active_ = (env->GetBooleanField(p, res->is_active_fieldID) != 0);
  return res;
}

void toggleSupergroupUsernameIsActive::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ToggleSupergroupUsernameIsActive");
    s.store_field("supergroupId", supergroup_id_);
    s.store_field("username", username_);
    s.store_field("isActive", is_active_);
    s.store_class_end();
  }
}

toggleSupergroupUsernameIsActive::ReturnType toggleSupergroupUsernameIsActive::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void toggleSupergroupUsernameIsActive::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ToggleSupergroupUsernameIsActive").c_str());
    supergroup_id_fieldID = jni::get_field_id(env, Class, "supergroupId", "J");
    username_fieldID = jni::get_field_id(env, Class, "username", "Ljava/lang/String;");
    is_active_fieldID = jni::get_field_id(env, Class, "isActive", "Z");
    return true;
  }();
  (void)is_inited;
}

jclass unpinChatMessage::Class;
jfieldID unpinChatMessage::chat_id_fieldID;
jfieldID unpinChatMessage::message_id_fieldID;

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

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

const std::int32_t unpinChatMessage::ID;

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

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

unpinChatMessage::ReturnType unpinChatMessage::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return ok::fetch(env, p);
}

void unpinChatMessage::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$UnpinChatMessage").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 validateOrderInfo::Class;
jfieldID validateOrderInfo::input_invoice_fieldID;
jfieldID validateOrderInfo::order_info_fieldID;
jfieldID validateOrderInfo::allow_save_fieldID;

validateOrderInfo::validateOrderInfo()
  : input_invoice_()
  , order_info_()
  , allow_save_()
{}

validateOrderInfo::validateOrderInfo(object_ptr<InputInvoice> &&input_invoice_, object_ptr<orderInfo> &&order_info_, bool allow_save_)
  : input_invoice_(std::move(input_invoice_))
  , order_info_(std::move(order_info_))
  , allow_save_(allow_save_)
{}

const std::int32_t validateOrderInfo::ID;

object_ptr<validateOrderInfo> validateOrderInfo::fetch(JNIEnv *env, jobject &p) {
  if (p == nullptr) return nullptr;
  init_jni_vars(env);
  object_ptr<validateOrderInfo> res = make_object<validateOrderInfo>();
  res->input_invoice_ = jni::fetch_tl_object<InputInvoice>(env, jni::fetch_object(env, p, res->input_invoice_fieldID));
  res->order_info_ = jni::fetch_tl_object<orderInfo>(env, jni::fetch_object(env, p, res->order_info_fieldID));
  res->allow_save_ = (env->GetBooleanField(p, res->allow_save_fieldID) != 0);
  return res;
}

void validateOrderInfo::store(TlStorerToString &s, const char *field_name) const {
  if (!LOG_IS_STRIPPED(ERROR)) {
    s.store_class_begin(field_name, "ValidateOrderInfo");
    s.store_object_field("inputInvoice", static_cast<const BaseObject *>(input_invoice_.get()));
    s.store_object_field("orderInfo", static_cast<const BaseObject *>(order_info_.get()));
    s.store_field("allowSave", allow_save_);
    s.store_class_end();
  }
}

validateOrderInfo::ReturnType validateOrderInfo::fetch_result(JNIEnv *env, jobject &p) {
  if (p == nullptr) return ReturnType();
  return validatedOrderInfo::fetch(env, p);
}

void validateOrderInfo::init_jni_vars(JNIEnv *env) {
  static bool is_inited = [&] {
    Class = jni::get_jclass(env, (PSLICE() << get_package_name_ref() << "/TdApi$ValidateOrderInfo").c_str());
    input_invoice_fieldID = jni::get_field_id(env, Class, "inputInvoice", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$InputInvoice;").c_str());
    order_info_fieldID = jni::get_field_id(env, Class, "orderInfo", (PSLICE() << "L" << get_package_name_ref() << "/TdApi$OrderInfo;").c_str());
    allow_save_fieldID = jni::get_field_id(env, Class, "allowSave", "Z");
    return true;
  }();
  (void)is_inited;
}
}  // namespace td_api
}  // namespace td
