Skip to content

Commit 4f54060

Browse files
committed
Multiple changes to how the library works and removed sample app
1 parent 9a0fa98 commit 4f54060

48 files changed

Lines changed: 300 additions & 368 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ buildscript {
1919
jcenter()
2020
}
2121
dependencies {
22-
classpath 'com.android.tools.build:gradle:2.2.3'
22+
classpath 'com.android.tools.build:gradle:2.3.1'
2323

2424
// NOTE: Do not place your application dependencies here; they belong
2525
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sat Mar 18 13:27:16 GMT 2017
1+
#Sun Apr 23 12:26:50 BST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.michaelfotiadis.steam;
2+
3+
import com.michaelfotiadis.steam.net.NetworkLoader;
4+
import com.michaelfotiadis.steam.provider.Dota2Provider;
5+
import com.michaelfotiadis.steam.provider.GamesProvider;
6+
import com.michaelfotiadis.steam.provider.PlayerProvider;
7+
8+
public class SteamLoader {
9+
10+
private final String key;
11+
private final NetworkLoader networkLoader;
12+
private Dota2Provider dota2Provider;
13+
private GamesProvider gamesProvider;
14+
private PlayerProvider playerProvider;
15+
16+
public SteamLoader(final String key, final boolean isDebugEnabled) {
17+
this.key = key;
18+
this.networkLoader = new NetworkLoader(isDebugEnabled);
19+
}
20+
21+
public SteamLoader(final String key) {
22+
this(key, false);
23+
}
24+
25+
public Dota2Provider getDota2Provider() {
26+
if (dota2Provider == null) {
27+
dota2Provider = new Dota2Provider(key, networkLoader.getDota2Api());
28+
}
29+
return dota2Provider;
30+
}
31+
32+
public GamesProvider getGamesProvider() {
33+
if (gamesProvider == null) {
34+
gamesProvider = new GamesProvider(key, networkLoader.getGamesApi());
35+
}
36+
return gamesProvider;
37+
}
38+
39+
public PlayerProvider getPlayerProvider() {
40+
if (playerProvider == null) {
41+
playerProvider = new PlayerProvider(key, networkLoader.getPlayerApi());
42+
}
43+
return playerProvider;
44+
}
45+
46+
}

net/src/main/java/com/michaelfotiadis/steam/net/NetworkLoader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.google.gson.Gson;
44
import com.michaelfotiadis.steam.net.api.Dota2Api;
55
import com.michaelfotiadis.steam.net.api.GamesApi;
6-
import com.michaelfotiadis.steam.net.api.SteamApi;
6+
import com.michaelfotiadis.steam.net.api.PlayerApi;
77
import com.michaelfotiadis.steam.net.gson.SteamGson;
88

99
public class NetworkLoader {
@@ -28,8 +28,8 @@ public GamesApi getGamesApi() {
2828
return this.steamRestClient.getGamesApi();
2929
}
3030

31-
public SteamApi getSteamApi() {
32-
return this.steamRestClient.getSteamApi();
31+
public PlayerApi getPlayerApi() {
32+
return this.steamRestClient.getPlayerApi();
3333
}
3434

3535
}

net/src/main/java/com/michaelfotiadis/steam/net/RestClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.google.gson.Gson;
44
import com.michaelfotiadis.steam.net.api.Dota2Api;
55
import com.michaelfotiadis.steam.net.api.GamesApi;
6-
import com.michaelfotiadis.steam.net.api.SteamApi;
6+
import com.michaelfotiadis.steam.net.api.PlayerApi;
77

88
import retrofit2.Retrofit;
99

@@ -27,8 +27,8 @@ public GamesApi getGamesApi() {
2727
return createApi(GamesApi.class);
2828
}
2929

30-
public SteamApi getSteamApi() {
31-
return createApi(SteamApi.class);
30+
public PlayerApi getPlayerApi() {
31+
return createApi(PlayerApi.class);
3232
}
3333

3434
private synchronized <T> T createApi(final Class<T> clazz) {

net/src/main/java/com/michaelfotiadis/steam/net/api/Dota2Api.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.michaelfotiadis.steam.dota2.model.response.MatchDetailsResponse;
44
import com.michaelfotiadis.steam.dota2.model.response.MatchHistoryResponse;
5-
import com.michaelfotiadis.steam.model.response.AccountResponse;
65

76
import retrofit2.Call;
87
import retrofit2.http.GET;
@@ -14,10 +13,6 @@ public interface Dota2Api {
1413
Call<MatchDetailsResponse> getMatchById(@Query("key") String key,
1514
@Query("match_id") String id);
1615

17-
@GET("ISteamUser/GetPlayerSummaries/v0002/")
18-
Call<AccountResponse> getPlayerById(@Query("key") String key,
19-
@Query("steamids") String id);
20-
2116
@GET("IDOTA2Match_570/GetMatchHistory/V001/")
2217
Call<MatchHistoryResponse> getMatchHistory(@Query("key") String key,
2318
@Query("account_id") String id,

net/src/main/java/com/michaelfotiadis/steam/net/api/GamesApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface GamesApi {
1111
@GET("IPlayerService/GetOwnedGames/v0001/?format=json")
1212
Call<LibraryResponse> getGamesList(@Query("key") String key,
1313
@Query("steamid") String id,
14-
@Query("include_appinfo") int includeAppInfo,
15-
@Query("include_played_free_games") int includePlayedFreeGames);
14+
@Query("include_appinfo") boolean includeAppInfo,
15+
@Query("include_played_free_games") boolean includePlayedFreeGames);
1616

1717
}

net/src/main/java/com/michaelfotiadis/steam/net/api/SteamApi.java renamed to net/src/main/java/com/michaelfotiadis/steam/net/api/PlayerApi.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.michaelfotiadis.steam.net.api;
22

33
import com.michaelfotiadis.steam.model.api.VanityResponse;
4+
import com.michaelfotiadis.steam.model.response.AccountResponse;
45

56
import retrofit2.Call;
67
import retrofit2.http.GET;
@@ -9,7 +10,11 @@
910
/**
1011
* Retrofit interface
1112
*/
12-
public interface SteamApi {
13+
public interface PlayerApi {
14+
15+
@GET("ISteamUser/GetPlayerSummaries/v0002/")
16+
Call<AccountResponse> getPlayerById(@Query("key") String key,
17+
@Query("steamids") String id);
1318

1419
@GET("ISteamUser/ResolveVanityURL/v0001/")
1520
Call<VanityResponse> getIdFromVanityUrl(@Query("key") String key,

net/src/main/java/com/michaelfotiadis/steam/net/callback/NetworkCallback.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.michaelfotiadis.steam.net.callback;
22

33
public interface NetworkCallback<T> {
4+
45
void onResponse(final String url, final T payload, final boolean is2XX, final int httpStatus);
56

67
void onFailure(final String url, Reason reason);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.michaelfotiadis.steam.net.callback;
22

33
public enum Reason {
4+
5+
46
DESERIALIZATION,
57
NETWORK_ISSUE,
68
TIMEOUT,
9+
HTTP_CODE_NOT_2XX,
710
UNKNOWN
811
}

0 commit comments

Comments
 (0)