Search in sources :

Example 1 with Builder

use of POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.PlatformRequest.Builder in project PokeGOAPI-Java by Grover-c13.

the class RequestHandler method buildRequest.

private RequestEnvelope.Builder buildRequest(ServerRequest[] requests, ServerPlatformRequest[] platformRequests) throws RequestFailedException {
    RequestEnvelope.Builder builder = RequestEnvelope.newBuilder();
    resetBuilder(builder);
    for (ServerRequest serverRequest : requests) {
        ByteString data = serverRequest.request.toByteString();
        Request request = Request.newBuilder().setRequestMessage(data).setRequestType(serverRequest.type).build();
        builder.addRequests(request);
    }
    Signature.setSignature(api, builder);
    for (ServerPlatformRequest platformRequest : platformRequests) {
        ByteString data = platformRequest.request;
        Builder request = PlatformRequest.newBuilder().setType(platformRequest.type).setRequestMessage(data);
        builder.addPlatformRequests(request);
    }
    return builder;
}
Also used : ByteString(com.google.protobuf.ByteString) Builder(POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.PlatformRequest.Builder) PlatformRequest(POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.PlatformRequest) Request(POGOProtos.Networking.Requests.RequestOuterClass.Request) RequestEnvelope(POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope)

Aggregations

RequestEnvelope (POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope)1 PlatformRequest (POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.PlatformRequest)1 Builder (POGOProtos.Networking.Envelopes.RequestEnvelopeOuterClass.RequestEnvelope.PlatformRequest.Builder)1 Request (POGOProtos.Networking.Requests.RequestOuterClass.Request)1 ByteString (com.google.protobuf.ByteString)1