mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Rename jsonrpc bulk to batch message
This commit is contained in:
parent
27a09fd408
commit
9c86baf0ea
5 changed files with 10 additions and 10 deletions
|
@ -4,11 +4,11 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public final class JsonRpcBulkMessage extends JsonRpcMessage {
|
||||
public final class JsonRpcBatchMessage extends JsonRpcMessage {
|
||||
|
||||
List<JsonNode> messages;
|
||||
|
||||
public JsonRpcBulkMessage(final List<JsonNode> messages) {
|
||||
public JsonRpcBatchMessage(final List<JsonNode> messages) {
|
||||
this.messages = messages;
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package org.asamk.signal.jsonrpc;
|
||||
|
||||
/**
|
||||
* Represents a JSON-RPC (bulk) request or (bulk) response.
|
||||
* Represents a JSON-RPC (batch) request or (batch) response.
|
||||
* https://www.jsonrpc.org/specification
|
||||
*/
|
||||
public sealed abstract class JsonRpcMessage permits JsonRpcBulkMessage, JsonRpcRequest, JsonRpcResponse {
|
||||
public sealed abstract class JsonRpcMessage permits JsonRpcBatchMessage, JsonRpcRequest, JsonRpcResponse {
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class JsonRpcReader {
|
|||
} else if (message instanceof JsonRpcResponse jsonRpcResponse) {
|
||||
responseHandler.accept(jsonRpcResponse);
|
||||
} else {
|
||||
final var responseList = ((JsonRpcBulkMessage) message).getMessages().stream().map(jsonNode -> {
|
||||
final var responseList = ((JsonRpcBatchMessage) message).getMessages().stream().map(jsonNode -> {
|
||||
final JsonRpcRequest request;
|
||||
try {
|
||||
request = parseJsonRpcRequest(jsonNode);
|
||||
|
@ -61,7 +61,7 @@ public class JsonRpcReader {
|
|||
return handleRequest(requestHandler, request);
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
|
||||
jsonRpcSender.sendBulkResponses(responseList);
|
||||
jsonRpcSender.sendBatchResponses(responseList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class JsonRpcReader {
|
|||
null), null));
|
||||
return null;
|
||||
}
|
||||
return new JsonRpcBulkMessage(StreamSupport.stream(jsonNode.spliterator(), false)
|
||||
return new JsonRpcBatchMessage(StreamSupport.stream(jsonNode.spliterator(), false)
|
||||
.collect(Collectors.toList()));
|
||||
} else if (jsonNode.isObject()) {
|
||||
if (jsonNode.has("result") || jsonNode.has("error")) {
|
||||
|
|
|
@ -16,7 +16,7 @@ public class JsonRpcSender {
|
|||
jsonWriter.write(request);
|
||||
}
|
||||
|
||||
public void sendBulkRequests(List<JsonRpcRequest> requests) {
|
||||
public void sendBatchRequests(List<JsonRpcRequest> requests) {
|
||||
jsonWriter.write(requests);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class JsonRpcSender {
|
|||
jsonWriter.write(response);
|
||||
}
|
||||
|
||||
public void sendBulkResponses(List<JsonRpcResponse> responses) {
|
||||
public void sendBatchResponses(List<JsonRpcResponse> responses) {
|
||||
jsonWriter.write(responses);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue