Search in sources :

Example 1 with ClanResult

use of com.faforever.api.clan.result.ClanResult in project faf-java-api by FAForever.

the class ClansController method me.

@ApiOperation("Grab data about yourself and the clan")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success with JSON { player: {id: ?, login: ?}, clan: { id: ?, name: ?, tag: ?}}"), @ApiResponse(code = 400, message = "Bad Request") })
@RequestMapping(path = "/me", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public MeResult me(Authentication authentication) {
    Player player = playerService.getPlayer(authentication);
    Clan clan = player.getClan();
    ClanResult clanResult = null;
    if (clan != null) {
        clanResult = ClanResult.of(clan);
    }
    return new MeResult(PlayerResult.of(player), clanResult);
}
Also used : Player(com.faforever.api.data.domain.Player) Clan(com.faforever.api.data.domain.Clan) MeResult(com.faforever.api.clan.result.MeResult) ClanResult(com.faforever.api.clan.result.ClanResult) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ClanResult (com.faforever.api.clan.result.ClanResult)1 MeResult (com.faforever.api.clan.result.MeResult)1 Clan (com.faforever.api.data.domain.Clan)1 Player (com.faforever.api.data.domain.Player)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1