package im.actor.core.api.rpc;
/*
* 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;
import im.actor.core.api.*;
public class RequestCreateGroup extends Request<ResponseCreateGroup> {
public static final int HEADER = 0xe6;
public static RequestCreateGroup fromBytes(byte[] data) throws IOException {
return Bser.parse(new RequestCreateGroup(), data);
}
private long rid;
private String title;
private List<ApiUserOutPeer> users;
private ApiGroupType groupType;
private List<ApiUpdateOptimization> optimizations;
public RequestCreateGroup(long rid, @NotNull String title, @NotNull List<ApiUserOutPeer> users, @Nullable ApiGroupType groupType, @NotNull List<ApiUpdateOptimization> optimizations) {
this.rid = rid;
this.title = title;
this.users = users;
this.groupType = groupType;
this.optimizations = optimizations;
}
public RequestCreateGroup() {
}
public long getRid() {
return this.rid;
}
@NotNull
public String getTitle() {
return this.title;
}
@NotNull
public List<ApiUserOutPeer> getUsers() {
return this.users;
}
@Nullable
public ApiGroupType getGroupType() {
return this.groupType;
}
@NotNull
public List<ApiUpdateOptimization> getOptimizations() {
return this.optimizations;
}
@Override
public void parse(BserValues values) throws IOException {
this.rid = values.getLong(1);
this.title = values.getString(2);
List<ApiUserOutPeer> _users = new ArrayList<ApiUserOutPeer>();
for (int i = 0; i < values.getRepeatedCount(3); i ++) {
_users.add(new ApiUserOutPeer());
}
this.users = values.getRepeatedObj(3, _users);
int val_groupType = values.getInt(6, 0);
if (val_groupType != 0) {
this.groupType = ApiGroupType.parse(val_groupType);
}
this.optimizations = new ArrayList<ApiUpdateOptimization>();
for (int b : values.getRepeatedInt(7)) {
optimizations.add(ApiUpdateOptimization.parse(b));
}
}
@Override
public void serialize(BserWriter writer) throws IOException {
writer.writeLong(1, this.rid);
if (this.title == null) {
throw new IOException();
}
writer.writeString(2, this.title);
writer.writeRepeatedObj(3, this.users);
if (this.groupType != null) {
writer.writeInt(6, this.groupType.getValue());
}
for (ApiUpdateOptimization i : this.optimizations) {
writer.writeInt(7, i.getValue());
}
}
@Override
public String toString() {
String res = "rpc CreateGroup{";
res += "rid=" + this.rid;
res += ", title=" + this.title;
res += ", groupType=" + this.groupType;
res += ", optimizations=" + this.optimizations;
res += "}";
return res;
}
@Override
public int getHeaderKey() {
return HEADER;
}
}