See https://kambur.ie/tips/shuffled/
This is to be automated one day :)
curl -X POST http://localhost:8080/deck-api/deck/create -H 'Content-Type: application/json' -d '{
"deckType": "standard52"
}'curl -X POST http://localhost:8080/deck-api/deck/create -H 'Content-Type: application/json' -d '{
"deckType": "uno"
}'curl -X PATCH http://localhost:8080/deck-api/deck/draw -H 'Content-Type: application/json' -d '{
"deckState":"rO0ABXcUAApzdGFuZGFyZDUyAAAANAAAAAB1cgACW0p4IAS1ErF1kwIAAHhwAAAAAHVxAH4AAAAAAAEAD////////w==","deckType":"standard52"
}'curl -X PATCH http://localhost:8080/deck-api/deck/draw -H 'Content-Type: application/json' -d '{
"deckState":"rO0ABXcNAAN1bm8AAABsAAAAAHVyAAJbSnggBLUSsXWTAgAAeHAAAAAAdXEAfgAAAAAAAv//////////AAAP//////8=","deckType":"uno"
}'curl -X PUT http://localhost:8080/deck-api/deck/return -H 'Content-Type: application/json' -d '{
"card":{"rank":"KING","suit":"CLUBS"},"deck":{"deckState":"rO0ABXcUAApzdGFuZGFyZDUyAAAAMwAAAAB1cgACW0p4IAS1ErF1kwIAAHhwAAAAAQAAAAACAAAAdXEAfgAAAAAAAQAP////////","deckType":"standard52"}
}'curl -X PUT http://localhost:8080/deck-api/deck/return -H 'Content-Type: application/json' -d '{
"card":{"colour":"RED","rank":"KING","ordinal":0},"deck":{"deckState":"<base64>","deckType":"uno"}
}'curl http://localhost:8080/deck-api/healthImplement Card and OrderedDeck.
Modify src/main/resources/META-INF/services/ie.kambur.Cards.core.interfaces.OrderedDeck to include the class name.
Serialisation of ShuffledDeck should suffice but one must implement CardJsonSerialiser like StandardCardJsonSerialiser.
Register the serialiser in src/main/resources/META-INF/services/ie.kambur.Cards.service.interfaces.CardJsonSerialiser.
bin/catalina.sh start
build/libs/deck-api.war ~/opt/tomcat/webapps See docker/Dockerfile.
As simple as
COPY build/libs/deck-api.war /usr/local/tomcat/webapps/
wget http://ramblings-app.ramblings.svc.cluster.local:8080/deck-api/healthcurl -X POST https://deck-api.api.kambur.ie/deck-api/deck/create -H 'Content-Type: application/json' -d '{
"deckType": "standard52"
}'
curl -X PUT https://deck-api.api.kambur.ie/deck-api/deck/return -H 'Content-Type: application/json' -d '{
"card":{"rank":"KING","suit":"CLUBS"},"deck":{"deckState":"rO0ABXcUAApzdGFuZGFyZDUyAAAAMwAAAAB1cgACW0p4IAS1ErF1kwIAAHhwAAAAAQAAAAACAAAAdXEAfgAAAAAAAQAP////////","deckType":"standard52"}
}'
curl -X PATCH https://deck-api.api.kambur.ie/deck-api/deck/draw -H 'Content-Type: application/json' -d '{
"deckState":"rO0ABXcUAApzdGFuZGFyZDUyAAAANAAAAAB1cgACW0p4IAS1ErF1kwIAAHhwAAAAAHVxAH4AAAAAAAEAD////////w==","deckType":"standard52"
}'Interactive API documentation is available at:
https://deck-api.api.kambur.ie/api-docs/swagger-ui.html
The OpenAPI spec is served at:
https://deck-api.api.kambur.ie/api-docs/shuffledDeck.yaml