Search in sources :

Example 1 with BggCollectionQueryParams

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

the class ThingsService method getPrivateThings.

public Mono<Collection> getPrivateThings(String username, String cookie, CollectionParams params) {
    BggCollectionQueryParams queryParams = collectionParamsMapper.toBggModel(params);
    queryParams.setUsername(username);
    // handle subtype bug in the BBG XML API
    if (queryParams.getSubtype() == null || queryParams.getSubtype().equals(CollectionItemSubtype.boardgame.value())) {
        queryParams.setExcludesubtype(CollectionItemSubtype.boardgameexpansion.value());
    }
    queryParams.setShowprivate(1);
    return collectionRepository.getCollection(cookie, queryParams).map(xml -> xmlProcessor.toJavaObject(xml, com.boardgamegeek.collection.Collection.class)).map(collectionMapper::fromBggModel);
}
Also used : ThingsParamsMapper(li.naska.bgg.mapper.ThingsParamsMapper) CollectionParams(li.naska.bgg.resource.v3.model.CollectionParams) Version(li.naska.bgg.resource.v3.model.Thing.Version) ThingsParams(li.naska.bgg.resource.v3.model.ThingsParams) PagingHelper(li.naska.bgg.util.PagingHelper) Autowired(org.springframework.beans.factory.annotation.Autowired) Page(li.naska.bgg.util.Page) CollectionMapper(li.naska.bgg.mapper.CollectionMapper) BggCollectionRepository(li.naska.bgg.repository.BggCollectionRepository) Service(org.springframework.stereotype.Service) Things(com.boardgamegeek.thing.Things) BggCollectionQueryParams(li.naska.bgg.repository.model.BggCollectionQueryParams) Thing(li.naska.bgg.resource.v3.model.Thing) XmlProcessor(li.naska.bgg.util.XmlProcessor) BggThingsRepository(li.naska.bgg.repository.BggThingsRepository) Video(li.naska.bgg.resource.v3.model.Thing.Video) ResponseStatusException(org.springframework.web.server.ResponseStatusException) BggThingsQueryParams(li.naska.bgg.repository.model.BggThingsQueryParams) CollectionItemSubtype(com.boardgamegeek.enums.CollectionItemSubtype) Mono(reactor.core.publisher.Mono) MarketplaceListing(li.naska.bgg.resource.v3.model.Thing.MarketplaceListing) Collectors(java.util.stream.Collectors) Comment(li.naska.bgg.resource.v3.model.Thing.Comment) PagingParams(li.naska.bgg.util.PagingParams) CollectionParamsMapper(li.naska.bgg.mapper.CollectionParamsMapper) ThingMapper(li.naska.bgg.mapper.ThingMapper) HttpStatus(org.springframework.http.HttpStatus) Flux(reactor.core.publisher.Flux) List(java.util.List) Collection(li.naska.bgg.resource.v3.model.Collection) BggCollectionQueryParams(li.naska.bgg.repository.model.BggCollectionQueryParams)

Example 2 with BggCollectionQueryParams

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

the class ThingsService method getThings.

public Mono<Collection> getThings(String username, CollectionParams params) {
    BggCollectionQueryParams queryParams = collectionParamsMapper.toBggModel(params);
    queryParams.setUsername(username);
    // handle subtype bug in the BBG XML API
    if (queryParams.getSubtype() == null || queryParams.getSubtype().equals(CollectionItemSubtype.boardgame.value())) {
        queryParams.setExcludesubtype(CollectionItemSubtype.boardgameexpansion.value());
    }
    return collectionRepository.getCollection(null, queryParams).map(xml -> xmlProcessor.toJavaObject(xml, com.boardgamegeek.collection.Collection.class)).map(collectionMapper::fromBggModel);
}
Also used : ThingsParamsMapper(li.naska.bgg.mapper.ThingsParamsMapper) CollectionParams(li.naska.bgg.resource.v3.model.CollectionParams) Version(li.naska.bgg.resource.v3.model.Thing.Version) ThingsParams(li.naska.bgg.resource.v3.model.ThingsParams) PagingHelper(li.naska.bgg.util.PagingHelper) Autowired(org.springframework.beans.factory.annotation.Autowired) Page(li.naska.bgg.util.Page) CollectionMapper(li.naska.bgg.mapper.CollectionMapper) BggCollectionRepository(li.naska.bgg.repository.BggCollectionRepository) Service(org.springframework.stereotype.Service) Things(com.boardgamegeek.thing.Things) BggCollectionQueryParams(li.naska.bgg.repository.model.BggCollectionQueryParams) Thing(li.naska.bgg.resource.v3.model.Thing) XmlProcessor(li.naska.bgg.util.XmlProcessor) BggThingsRepository(li.naska.bgg.repository.BggThingsRepository) Video(li.naska.bgg.resource.v3.model.Thing.Video) ResponseStatusException(org.springframework.web.server.ResponseStatusException) BggThingsQueryParams(li.naska.bgg.repository.model.BggThingsQueryParams) CollectionItemSubtype(com.boardgamegeek.enums.CollectionItemSubtype) Mono(reactor.core.publisher.Mono) MarketplaceListing(li.naska.bgg.resource.v3.model.Thing.MarketplaceListing) Collectors(java.util.stream.Collectors) Comment(li.naska.bgg.resource.v3.model.Thing.Comment) PagingParams(li.naska.bgg.util.PagingParams) CollectionParamsMapper(li.naska.bgg.mapper.CollectionParamsMapper) ThingMapper(li.naska.bgg.mapper.ThingMapper) HttpStatus(org.springframework.http.HttpStatus) Flux(reactor.core.publisher.Flux) List(java.util.List) Collection(li.naska.bgg.resource.v3.model.Collection) BggCollectionQueryParams(li.naska.bgg.repository.model.BggCollectionQueryParams)

Aggregations

CollectionItemSubtype (com.boardgamegeek.enums.CollectionItemSubtype)2 Things (com.boardgamegeek.thing.Things)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 CollectionMapper (li.naska.bgg.mapper.CollectionMapper)2 CollectionParamsMapper (li.naska.bgg.mapper.CollectionParamsMapper)2 ThingMapper (li.naska.bgg.mapper.ThingMapper)2 ThingsParamsMapper (li.naska.bgg.mapper.ThingsParamsMapper)2 BggCollectionRepository (li.naska.bgg.repository.BggCollectionRepository)2 BggThingsRepository (li.naska.bgg.repository.BggThingsRepository)2 BggCollectionQueryParams (li.naska.bgg.repository.model.BggCollectionQueryParams)2 BggThingsQueryParams (li.naska.bgg.repository.model.BggThingsQueryParams)2 Collection (li.naska.bgg.resource.v3.model.Collection)2 CollectionParams (li.naska.bgg.resource.v3.model.CollectionParams)2 Thing (li.naska.bgg.resource.v3.model.Thing)2 Comment (li.naska.bgg.resource.v3.model.Thing.Comment)2 MarketplaceListing (li.naska.bgg.resource.v3.model.Thing.MarketplaceListing)2 Version (li.naska.bgg.resource.v3.model.Thing.Version)2 Video (li.naska.bgg.resource.v3.model.Thing.Video)2 ThingsParams (li.naska.bgg.resource.v3.model.ThingsParams)2