forked from lagom/online-auction-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchService.java
26 lines (20 loc) · 978 Bytes
/
SearchService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.example.auction.search.api;
import com.lightbend.lagom.javadsl.api.Descriptor;
import com.lightbend.lagom.javadsl.api.Service;
import com.lightbend.lagom.javadsl.api.ServiceCall;
import com.lightbend.lagom.javadsl.api.deser.PathParamSerializers;
import com.lightbend.lagom.javadsl.api.transport.Method;
import java.util.UUID;
import static com.lightbend.lagom.javadsl.api.Service.named;
public interface SearchService extends Service {
ServiceCall<SearchRequest, SearchResult> search(int pageNo, int pageSize);
@Override
default Descriptor descriptor() {
// TODO: add authentication? I don't think searching needs authentication... Hmmm...
return named("search").withCalls(
Service.restCall(Method.GET, "/search?pageNo&pageSize", this::search)
).withPathParamSerializer(
UUID.class, PathParamSerializers.optional("UUID", UUID::fromString, UUID::toString)
).withAutoAcl(true);
}
}