Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.knoldus;
import akka.Done;
import akka.NotUsed;
import com.lightbend.lagom.javadsl.api.Descriptor;
import com.lightbend.lagom.javadsl.api.Service;
import com.lightbend.lagom.javadsl.api.ServiceCall;
import java.util.List;
import java.util.Optional;
import static com.lightbend.lagom.javadsl.api.Service.named;
import static com.lightbend.lagom.javadsl.api.Service.restCall;
import static com.lightbend.lagom.javadsl.api.transport.Method.*;
public interface BookService extends Service {
/**
* @param isbn
* @return
*/
ServiceCall<NotUsed, Optional<Book>> getBook(String isbn);
/**
* @return
*/
ServiceCall<Book, Done> newBook();
/**
* @return
*/
ServiceCall<Book, Done> updateBook();
/**
* @param isbn
* @return
*/
ServiceCall<NotUsed, Done> deleteBook(String isbn);
ServiceCall<NotUsed, List<Book>> getAllBook();
/**
* @return
*/
@Override
default Descriptor descriptor() {
return named("book").withCalls(
restCall(GET, "/api/books/:isbn", this::getBook),
restCall(POST, "/api/books", this::newBook),
restCall(PUT, "/api/books", this::updateBook),
restCall(DELETE, "/api/books/:isbn", this::deleteBook),
restCall(GET, "/api/books", this::getAllBook)
).withAutoAcl(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.