All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.action.DeleteChatActionSpec Maven / Gradle / Ivy

package it.auties.whatsapp.model.action;

import it.auties.whatsapp.model.action.DeleteChatAction;
import it.auties.protobuf.stream.ProtobufInputStream;
import it.auties.protobuf.stream.ProtobufOutputStream;

public class DeleteChatActionSpec {
    public static byte[] encode(DeleteChatAction protoInputObject) {
      if(protoInputObject == null) {
         return null;
      }
      var outputStream = new ProtobufOutputStream();
var messageRange = protoInputObject.messageRange();
var messageRange0 = messageRange.orElse(null);
if(messageRange0 != null) {
outputStream.writeBytes(1, it.auties.whatsapp.model.sync.ActionMessageRangeSyncSpec.encode(messageRange0));
}
      return outputStream.toByteArray();
    }

    public static DeleteChatAction decode(byte[] input) {
        if(input == null) {
            return null;
        }
        var inputStream = new ProtobufInputStream(input);
        java.util.Optional messageRange = java.util.Optional.empty();
        while(inputStream.readTag()) {
            switch(inputStream.index()) {
                case 1 -> messageRange = java.util.Optional.ofNullable(it.auties.whatsapp.model.sync.ActionMessageRangeSyncSpec.decode(inputStream.readBytes()));
                default -> inputStream.skipBytes();
            }
        }
        return new it.auties.whatsapp.model.action.DeleteChatAction(messageRange);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy