Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
1,691 additions
and
0 deletions.
There are no files selected for viewing
111 changes: 111 additions & 0 deletions
111
src/main/java/com/lukaspradel/steamapi/webapi/request/GetFriendListRequest.java
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,111 @@ | ||
package com.lukaspradel.steamapi.webapi.request; | ||
|
||
import com.lukaspradel.steamapi.webapi.core.SteamWebApiInterface; | ||
import com.lukaspradel.steamapi.webapi.core.SteamWebApiInterfaceMethod; | ||
import com.lukaspradel.steamapi.webapi.core.SteamWebApiVersion; | ||
import com.lukaspradel.steamapi.webapi.request.builders.AbstractSteamWebApiRequestBuilder; | ||
|
||
/** | ||
* Steam Web API Request GetFriendList | ||
* | ||
* @see <a href= | ||
* "https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_.28v0001.29" | ||
* >https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_.28v0001.29</a> | ||
* @author lpradel | ||
* | ||
*/ | ||
public class GetFriendListRequest extends SteamWebApiRequest { | ||
|
||
private GetFriendListRequest(SteamWebApiRequestBuilder builder) { | ||
super(builder); | ||
} | ||
|
||
/** | ||
* Relationship filter for request type {@link GetFriendListRequest}. | ||
* | ||
* @author lpradel | ||
* | ||
*/ | ||
public enum Relationship { | ||
|
||
/** Users with ANY relationship to the user */ | ||
ALL("all"), | ||
/** Only users with the FRIEND relationship to the user */ | ||
FRIEND("friend"); | ||
|
||
private final String relationship; | ||
|
||
private Relationship(String relationship) { | ||
|
||
this.relationship = relationship; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
|
||
return relationship; | ||
} | ||
} | ||
|
||
/** | ||
* Builder object to create instances of {@link SteamWebApiRequest} for | ||
* request type {@link GetFriendListRequest}. | ||
* | ||
* @author lpradel | ||
* | ||
*/ | ||
public static class GetFriendListRequestBuilder extends | ||
AbstractSteamWebApiRequestBuilder { | ||
|
||
private final String steamId; | ||
|
||
private Relationship relationship = null; | ||
|
||
public static final String REQUEST_PARAM_STEAM_ID = "steamid"; | ||
|
||
public static final String REQUEST_PARAM_RELATIONSHIP = "relationship"; | ||
|
||
public GetFriendListRequestBuilder(String steamId) { | ||
|
||
this.steamId = steamId; | ||
} | ||
|
||
public GetFriendListRequestBuilder relationship( | ||
Relationship relationship) { | ||
|
||
this.relationship = relationship; | ||
return this; | ||
} | ||
|
||
@Override | ||
protected SteamWebApiInterface getInterface() { | ||
|
||
return SteamWebApiInterface.I_STEAM_USER; | ||
} | ||
|
||
@Override | ||
protected SteamWebApiInterfaceMethod getInterfaceMethod() { | ||
|
||
return SteamWebApiInterfaceMethod.GET_FRIEND_LIST; | ||
} | ||
|
||
@Override | ||
protected SteamWebApiVersion getVersion() { | ||
|
||
return SteamWebApiVersion.VERSION_ONE; | ||
} | ||
|
||
@Override | ||
public GetFriendListRequest buildRequest() { | ||
|
||
addParameter(REQUEST_PARAM_STEAM_ID, steamId); | ||
|
||
if (relationship != null) { | ||
addParameter(REQUEST_PARAM_RELATIONSHIP, | ||
relationship.toString()); | ||
} | ||
|
||
return new GetFriendListRequest(this); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.