mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
Implement jsonRpc command
Co-authored-by: technillogue <technillogue@gmail.com> Closes #668
This commit is contained in:
parent
6c00054407
commit
a8bbdb54d0
20 changed files with 863 additions and 31 deletions
24
src/main/java/org/asamk/signal/commands/VersionCommand.java
Normal file
24
src/main/java/org/asamk/signal/commands/VersionCommand.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package org.asamk.signal.commands;
|
||||
|
||||
import org.asamk.signal.BaseConfig;
|
||||
import org.asamk.signal.JsonWriter;
|
||||
import org.asamk.signal.OutputWriter;
|
||||
import org.asamk.signal.commands.exceptions.CommandException;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class VersionCommand implements JsonRpcCommand<Void> {
|
||||
|
||||
private final OutputWriter outputWriter;
|
||||
|
||||
public VersionCommand(final OutputWriter outputWriter) {
|
||||
this.outputWriter = outputWriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(final Void request, final Manager m) throws CommandException {
|
||||
final var jsonWriter = (JsonWriter) outputWriter;
|
||||
jsonWriter.write(Map.of("version", BaseConfig.PROJECT_VERSION));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue