Skip to content

Commit

Permalink
Updated rest api stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte Schütze committed Jan 25, 2015
1 parent 8e9f67f commit e35a45d
Show file tree
Hide file tree
Showing 11 changed files with 320 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
##### Domain
* Added missing game mutators to practice game config
* Added LobbyMetaData
* Updated Season

##### Rtmp
* Fixed typo in gameService.startChampSelect
* Fixed a bug where the handshake failed on slow connections
* Fixed an incorrect parameter to PlayerPreferenceService.loadPreferenceByKey

##### Rest
* Fixed an incorrect return type for the match endpoint
* Added missing fields to match
* Added maps endpoint to static data
* Added locales and localized messages endpoint to static dat<

##### Xmpp
* Added helper method for sending messages to summoner ids.
* Added method for joining a chat room without name hashing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
public enum Season {
PRESEASON3(3),
SEASON3(3),
PRESEASON4(4),
SEASON4(4),
PREASEASON5(5),
SEASON5(5);
PRESEASON2014(4),
SEASON2014(4),
PREASEASON2015(5),
SEASON2015(5);

public final int numeric;

Expand Down
84 changes: 81 additions & 3 deletions rest/src/main/java/net/boreeas/riotapi/rest/ApiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public List<Game> getRecentGames(long summoner) {

// </editor-fold>

// <editor-fold desc="League v2.4">
// <editor-fold desc="League v2.5">

/**
* Get a listing of leagues for the summoner
Expand Down Expand Up @@ -927,6 +927,84 @@ public List<String> getVersions() {
return gson.fromJson($(tgt), type);
}

/**
* <p>
* Retrieve map information
* </p>
* This method does not count towards the rate limit
*
* @return The list of all available map.
* @see <a href="https://developer.riotgames.com/api/methods#!/931">The official api documentation</a>
*/
public MapDataOverview getMaps() {
WebTarget tgt = staticDataTarget.path("map");
return gson.fromJson($(tgt), MapDataOverview.class);
}

/**
* <p>
* Retrieve map information
* </p>
* This method does not count towards the rate limit
*
* @param version The data dragon version.
* @param locale The locale information.
*
* @return The list of all available maps.
* @see <a href="https://developer.riotgames.com/api/methods#!/931">The official api documentation</a>
*/
public MapDataOverview getMaps(String version, String locale) {
WebTarget tgt = staticDataTarget.path("map").queryParam("version", version).queryParam("locale", locale);
return gson.fromJson($(tgt), MapDataOverview.class);
}

/**
* <p>
* Retrieve supported locales for the specified region
* </p>
* This method does not count towards your rate limit
*
* @return A list of locales
* @see <a href="https://developer.riotgames.com/api/methods#!/931/3226">The official api documentation</a>
*/
public List<String> getLocales() {
Type type = new TypeToken<List<String>>() {
}.getType();
WebTarget tgt = staticDataTarget.path("languages");
return gson.fromJson($(tgt), type);
}

/**
* <p>
* Retrieve localized strings for the english locale
* </p>
* This method does not count towards your rate limit
*
* @return A list of localized message
* @see <a href="https://developer.riotgames.com/api/methods#!/931/3226">The official api documentation</a>
*/
public LocalizedMessages getLocalizedMessages() {
WebTarget tgt = staticDataTarget.path("language-strings");
return gson.fromJson($(tgt), LocalizedMessages.class);
}

/**
* <p>
* Retrieve localized strings for the english locale
* </p>
* This method does not count towards your rate limit
*
* @param version The data dragon version of the data
* @param locale The locale to lookup.
*
* @return A list of localized message
* @see <a href="https://developer.riotgames.com/api/methods#!/931/3226">The official api documentation</a>
*/
public LocalizedMessages getLocalizedMessages(String version, String locale) {
WebTarget tgt = staticDataTarget.path("language-strings").queryParam("version", version).queryParam("locale", locale);
return gson.fromJson($(tgt), LocalizedMessages.class);
}

// </editor-fold>

// <editor-fold desc="Status v1.0">
Expand Down Expand Up @@ -971,7 +1049,7 @@ public ShardStatus getShardStatus(Shard shard) {
* @return The match details.
* @see <a href="https://developer.riotgames.com/api/methods#!/806/2848">Official API Documentation</a>
*/
public MatchDetail getMatch(long matchId) {
public Match getMatch(long matchId) {
return getMatch(matchId, true);
}

Expand All @@ -983,7 +1061,7 @@ public MatchDetail getMatch(long matchId) {
* @return The match details.
* @see <a href="https://developer.riotgames.com/api/methods#!/806/2848">Official API Documentation</a>
*/
public MatchDetail getMatch(long matchId, boolean includeTimeline) {
public Match getMatch(long matchId, boolean includeTimeline) {
WebTarget tgt = matchInfoTarget.path("" + matchId).queryParam("includeTimeline", includeTimeline);
return gson.fromJson($(tgt), MatchDetail.class);
}
Expand Down
37 changes: 37 additions & 0 deletions rest/src/main/java/net/boreeas/riotapi/rest/LocalizedMessages.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
/*
* Copyright 2015 The LolDevs team (https://github.com/loldevs)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.boreeas.riotapi.rest;

import lombok.Data;
import net.boreeas.riotapi.Version;

import java.util.HashMap;
import java.util.Map;

/**
* The localized messages as returned by the api
* @author Malte Schütze
*/
@Data
public class LocalizedMessages {
/**
* The actual messages
*/
private Map<String, String> data = new HashMap<>();
/**
* The type of this data. Always "language"
*/
private String type;
private String version;

public Version getVersion() {
return new Version(version);
}
}
39 changes: 39 additions & 0 deletions rest/src/main/java/net/boreeas/riotapi/rest/MapData.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
/*
* Copyright 2015 The LolDevs team (https://github.com/loldevs)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.boreeas.riotapi.rest;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
* Basic map information
* @author Malte Schütze
*/
@Data
public class MapData {
/**
* The id of the map
*/
private int mapId;
/**
* The items which can't get bought on this map
*/
private List<Integer> unpurchasableItemList = new ArrayList<>();
/**
* Image data for the map
*/
private Image image;
/**
* The name of the map
*/
private String mapName;
}
23 changes: 23 additions & 0 deletions rest/src/main/java/net/boreeas/riotapi/rest/MapDataOverview.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,33 @@

package net.boreeas.riotapi.rest;

import lombok.Data;
import net.boreeas.riotapi.Version;

import java.util.HashMap;
import java.util.Map;

/**
* Basic map information
* @author Malte Schütze
*/
@Data
public class MapDataOverview {
/**
* Maps map id to map data
*/
private Map<Integer, MapData> data = new HashMap<>();
/**
* The type of information. Always "map"
*/
private String type;
private String version;

/**
* The data dragon version of this data
* @return The version
*/
public Version getVersion() {
return new Version(version);
}
}
6 changes: 6 additions & 0 deletions rest/src/main/java/net/boreeas/riotapi/rest/Match.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import net.boreeas.riotapi.com.riotgames.platform.game.GameMode;
import net.boreeas.riotapi.com.riotgames.platform.game.GameType;
import net.boreeas.riotapi.com.riotgames.platform.game.QueueType;
import net.boreeas.riotapi.com.riotgames.team.dto.Team;
import net.boreeas.riotapi.constants.Season;

import java.util.ArrayList;
import java.util.Date;
Expand All @@ -41,4 +43,8 @@ public class Match {
private GameMode matchMode;
private GameType matchType;
private QueueType queueType;
private String platformId;
private List<Team> teams = new ArrayList<>();
private MatchTimeline timeline;
private Season season;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.boreeas.riotapi.constants.Season;

/**
* This class is no longer needed, but for compatibility reasons can't be removed
* @author Malte Schütze
*/
@Getter
Expand Down
Loading

0 comments on commit e35a45d

Please sign in to comment.