mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
31 lines
1 KiB
Java
31 lines
1 KiB
Java
package org.asamk.signal.commands;
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
import net.sourceforge.argparse4j.inf.Namespace;
|
|
|
|
import org.asamk.signal.OutputType;
|
|
import org.asamk.signal.commands.exceptions.CommandException;
|
|
import org.asamk.signal.manager.MultiAccountManager;
|
|
import org.asamk.signal.output.JsonWriter;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public interface JsonRpcMultiLocalCommand extends JsonRpcMultiCommand<Map<String, Object>>, MultiLocalCommand {
|
|
|
|
default TypeReference<Map<String, Object>> getRequestType() {
|
|
return new TypeReference<>() {};
|
|
}
|
|
|
|
default void handleCommand(
|
|
Map<String, Object> request, MultiAccountManager c, JsonWriter jsonWriter
|
|
) throws CommandException {
|
|
Namespace commandNamespace = new JsonRpcNamespace(request == null ? Map.of() : request);
|
|
handleCommand(commandNamespace, c, jsonWriter);
|
|
}
|
|
|
|
default List<OutputType> getSupportedOutputTypes() {
|
|
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
|
}
|
|
}
|