Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added api/conf/version getConfigVersion
Added api/conf getConfig Added api/conf/my getUserGameData Added api/achievements saveAchievemnt Added tests
- Loading branch information
Brian
committed
Nov 6, 2010
1 parent
3fe156a
commit 6e7b5d6
Showing
14 changed files
with
399 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.mogade.java.data; | ||
|
||
public class Achievement | ||
{ | ||
private String id; | ||
private String name; | ||
private String desc; | ||
private long points; | ||
|
||
private Achievement() | ||
{ | ||
} | ||
public Achievement(String id, String name, String desc, long points) | ||
{ | ||
this.id = id; | ||
this.name = name; | ||
this.desc = desc; | ||
this.points = points; | ||
} | ||
|
||
public String getId() | ||
{ | ||
return id; | ||
} | ||
public String getName() | ||
{ | ||
return name; | ||
} | ||
public String getDescription() | ||
{ | ||
return desc; | ||
} | ||
public long getPoints() | ||
{ | ||
return points; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.mogade.java.protocol; | ||
|
||
public class GetConfigRequest extends BaseRequestImpl | ||
{ | ||
public GetConfigRequest(String key, int v) | ||
{ | ||
super(key, v); | ||
} | ||
|
||
public RequestMethod getRequestMethod() | ||
{ | ||
return RequestMethod.POST; | ||
} | ||
|
||
public String getUrl() | ||
{ | ||
return "api/conf"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.mogade.java.protocol; | ||
|
||
import com.mogade.java.data.Achievement; | ||
|
||
import java.util.List; | ||
|
||
public class GetConfigResponse extends GetConfigVersionResponse | ||
{ | ||
private List<Achievement> achievements; | ||
|
||
private GetConfigResponse() | ||
{ | ||
} | ||
public GetConfigResponse(String info, String maintenance, String error) | ||
{ | ||
super(info, maintenance, error); | ||
} | ||
|
||
public boolean hasAchievements() | ||
{ | ||
return (achievements != null && achievements.size() > 0); | ||
} | ||
public List<Achievement> getAchievements() | ||
{ | ||
return achievements; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.mogade.java.protocol; | ||
|
||
public class GetUserGameDataRequest extends BaseRequestImpl | ||
{ | ||
private String username; | ||
private String unique; | ||
|
||
public GetUserGameDataRequest(String key, int v, String username, String unique) | ||
{ | ||
super(key, v); | ||
this.username = username; | ||
this.unique = unique; | ||
} | ||
|
||
public RequestMethod getRequestMethod() | ||
{ | ||
return RequestMethod.POST; | ||
} | ||
public String getUrl() | ||
{ | ||
return "api/conf/my"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.mogade.java.protocol; | ||
|
||
import java.util.List; | ||
|
||
public class GetUserGameDataResponse extends BaseResponseImpl | ||
{ | ||
private List<String> achievements; | ||
|
||
private GetUserGameDataResponse() | ||
{ | ||
} | ||
public GetUserGameDataResponse(String info, String maintenance, String error) | ||
{ | ||
super(info, maintenance, error); | ||
} | ||
|
||
public boolean hasAchievements() | ||
{ | ||
return (achievements != null && achievements.size() > 0); | ||
} | ||
public List<String> getAchievements() | ||
{ | ||
return achievements; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.mogade.java.protocol; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
public class SaveAchievementRequest extends BaseRequestImpl | ||
{ | ||
@SerializedName("achievement_id") | ||
private String achievementId; | ||
private String username; | ||
private String unique; | ||
|
||
public SaveAchievementRequest(String key, int v, String achievementId, String username, String unique) | ||
{ | ||
super(key, v); | ||
this.achievementId = achievementId; | ||
this.username = username; | ||
this.unique = unique; | ||
} | ||
|
||
public String getUrl() | ||
{ | ||
return "api/achievements"; | ||
} | ||
public RequestMethod getRequestMethod() | ||
{ | ||
return RequestMethod.PUT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.mogade.java.protocol; | ||
|
||
public class SaveAchievementResponse extends BaseResponseImpl | ||
{ | ||
private long points; | ||
|
||
private SaveAchievementResponse() | ||
{ | ||
} | ||
public SaveAchievementResponse(String info, String maintenance, String error) | ||
{ | ||
super(info, maintenance, error); | ||
} | ||
|
||
public long getPoints() | ||
{ | ||
return points; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.