Search in sources :

Example 1 with BggGeekplayRequestBody

use of li.naska.bgg.repository.model.BggGeekplayRequestBody in project bgg-api by tnaskali.

the class PlaysService method updatePrivatePlay.

@SneakyThrows
public Mono<BggGeekplayResponseBody> updatePrivatePlay(Integer id, String cookie, Play play) {
    if (!Objects.equals(id, play.getId())) {
        throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Play ID mismatch");
    }
    BggGeekplayRequestBody requestBody = geekplayParamsMapper.toBggModel(play);
    requestBody.setAction("save");
    requestBody.setAjax(1);
    requestBody.setVersion(2);
    return geekplaysRepository.updateGeekplay(cookie, requestBody);
}
Also used : ResponseStatusException(org.springframework.web.server.ResponseStatusException) BggGeekplayRequestBody(li.naska.bgg.repository.model.BggGeekplayRequestBody) SneakyThrows(lombok.SneakyThrows)

Example 2 with BggGeekplayRequestBody

use of li.naska.bgg.repository.model.BggGeekplayRequestBody in project bgg-api by tnaskali.

the class PlaysService method createPrivatePlay.

@SneakyThrows
public Mono<BggGeekplayResponseBody> createPrivatePlay(String cookie, Play play) {
    BggGeekplayRequestBody requestBody = geekplayParamsMapper.toBggModel(play);
    requestBody.setAction("save");
    requestBody.setAjax(1);
    return geekplaysRepository.updateGeekplay(cookie, requestBody);
}
Also used : BggGeekplayRequestBody(li.naska.bgg.repository.model.BggGeekplayRequestBody) SneakyThrows(lombok.SneakyThrows)

Example 3 with BggGeekplayRequestBody

use of li.naska.bgg.repository.model.BggGeekplayRequestBody in project bgg-api by tnaskali.

the class PlaysService method deletePrivatePlay.

public Mono<BggGeekplayResponseBody> deletePrivatePlay(Integer id, String cookie) {
    BggGeekplayRequestBody requestBody = new BggGeekplayRequestBody();
    requestBody.setPlayid(id);
    requestBody.setAction("delete");
    requestBody.setAjax(1);
    requestBody.setFinalize(1);
    return geekplaysRepository.updateGeekplay(cookie, requestBody);
}
Also used : BggGeekplayRequestBody(li.naska.bgg.repository.model.BggGeekplayRequestBody)

Aggregations

BggGeekplayRequestBody (li.naska.bgg.repository.model.BggGeekplayRequestBody)3 SneakyThrows (lombok.SneakyThrows)2 ResponseStatusException (org.springframework.web.server.ResponseStatusException)1