it.auties.whatsapp.model.action.ChatAssignmentActionSpec Maven / Gradle / Ivy
package it.auties.whatsapp.model.action;
import it.auties.whatsapp.model.action.ChatAssignmentAction;
import it.auties.protobuf.stream.ProtobufInputStream;
import it.auties.protobuf.stream.ProtobufOutputStream;
public class ChatAssignmentActionSpec {
public static byte[] encode(ChatAssignmentAction protoInputObject) {
if(protoInputObject == null) {
return null;
}
var outputStream = new ProtobufOutputStream();
var deviceAgentId = protoInputObject.deviceAgentId();
var deviceAgentId0 = deviceAgentId.orElse(null);
if(deviceAgentId0 != null) {
outputStream.writeString(1, deviceAgentId0);
}
return outputStream.toByteArray();
}
public static ChatAssignmentAction decode(byte[] input) {
if(input == null) {
return null;
}
var inputStream = new ProtobufInputStream(input);
java.util.Optional deviceAgentId = java.util.Optional.empty();
while(inputStream.readTag()) {
switch(inputStream.index()) {
case 1 -> deviceAgentId = java.util.Optional.ofNullable(inputStream.readString());
default -> inputStream.skipBytes();
}
}
return new it.auties.whatsapp.model.action.ChatAssignmentAction(deviceAgentId);
}
}