package im.actor.core.api; /* * Generated by the Actor API Scheme generator. DO NOT EDIT! */ import im.actor.runtime.bser.*; import im.actor.runtime.collections.*; import static im.actor.runtime.bser.Utils.*; import im.actor.core.network.parser.*; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; import com.google.j2objc.annotations.ObjectiveCName; import java.io.IOException; import java.util.List; import java.util.ArrayList; public class ApiTextModernMessage extends ApiTextMessageEx { private String text; private String senderNameOverride; private ApiAvatar senderPhotoOverride; private ApiParagraphStyle style; private List<ApiTextModernAttach> attaches; public ApiTextModernMessage(@Nullable String text, @Nullable String senderNameOverride, @Nullable ApiAvatar senderPhotoOverride, @Nullable ApiParagraphStyle style, @NotNull List<ApiTextModernAttach> attaches) { this.text = text; this.senderNameOverride = senderNameOverride; this.senderPhotoOverride = senderPhotoOverride; this.style = style; this.attaches = attaches; } public ApiTextModernMessage() { } public int getHeader() { return 2; } @Nullable public String getText() { return this.text; } @Nullable public String getSenderNameOverride() { return this.senderNameOverride; } @Nullable public ApiAvatar getSenderPhotoOverride() { return this.senderPhotoOverride; } @Nullable public ApiParagraphStyle getStyle() { return this.style; } @NotNull public List<ApiTextModernAttach> getAttaches() { return this.attaches; } @Override public void parse(BserValues values) throws IOException { this.text = values.optString(1); this.senderNameOverride = values.optString(2); this.senderPhotoOverride = values.optObj(3, new ApiAvatar()); this.style = values.optObj(4, new ApiParagraphStyle()); List<ApiTextModernAttach> _attaches = new ArrayList<ApiTextModernAttach>(); for (int i = 0; i < values.getRepeatedCount(5); i ++) { _attaches.add(new ApiTextModernAttach()); } this.attaches = values.getRepeatedObj(5, _attaches); if (values.hasRemaining()) { setUnmappedObjects(values.buildRemaining()); } } @Override public void serialize(BserWriter writer) throws IOException { if (this.text != null) { writer.writeString(1, this.text); } if (this.senderNameOverride != null) { writer.writeString(2, this.senderNameOverride); } if (this.senderPhotoOverride != null) { writer.writeObject(3, this.senderPhotoOverride); } if (this.style != null) { writer.writeObject(4, this.style); } writer.writeRepeatedObj(5, this.attaches); if (this.getUnmappedObjects() != null) { SparseArray<Object> unmapped = this.getUnmappedObjects(); for (int i = 0; i < unmapped.size(); i++) { int key = unmapped.keyAt(i); writer.writeUnmapped(key, unmapped.get(key)); } } } @Override public String toString() { String res = "struct TextModernMessage{"; res += "text=" + this.text; res += ", senderNameOverride=" + this.senderNameOverride; res += ", senderPhotoOverride=" + this.senderPhotoOverride; res += ", style=" + this.style; res += ", attaches=" + this.attaches; res += "}"; return res; } }