Skip to content

Instantly share code, notes, and snippets.

@PsychoPast
Forked from Amrsatrio/AccountService.java
Created October 11, 2019 15:29
Show Gist options
  • Save PsychoPast/99e8907af938d71e934b2a9c7c3538fd to your computer and use it in GitHub Desktop.
Save PsychoPast/99e8907af938d71e934b2a9c7c3538fd to your computer and use it in GitHub Desktop.
some epic/fortnite endpoints
package com.tb24.fn.network;
import com.google.gson.JsonObject;
import com.tb24.fn.model.DeviceAuth;
import com.tb24.fn.model.ExchangeResponse;
import com.tb24.fn.model.ExternalAuth;
import com.tb24.fn.model.GameProfile;
import com.tb24.fn.model.LoginResponse;
import com.tb24.fn.model.QueryExternalIdMappingsByIdPayload;
import com.tb24.fn.model.VerifyResponse;
import com.tb24.fn.model.XGameProfile;
import java.util.List;
import java.util.Map;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface AccountPublicService {
String BASE_URL = "https://account-public-service-prod.ol.epicgames.com";
/**
* grant_type: authorization_code; fields: code
* grant_type: client_credentials -- used to retrieve client ID without sign in
* grant_type: device_auth; fields: account_id, device_id, secret
* grant_type: exchange_code; fields: exchange_code
* grant_type: external_auth; fields: external_auth_type, external_auth_token
* grant_type: otp; fields: otp, challenge
* grant_type: password; fields: username, password
* grant_type: refresh_token; fields: refresh_token
*/
@FormUrlEncoded
@POST("/account/api/oauth/token")
Call<LoginResponse> grantToken(@Header("Authorization") String auth, @Field("grant_type") String grantType, @FieldMap Map<String, String> fields, @Field("includePerms") Boolean includePerms);
@GET("/account/api/oauth/exchange")
Call<ExchangeResponse> exchangeToken();
@GET("/account/api/oauth/verify")
Call<VerifyResponse> verifyToken(@Query("includePerms") Boolean includePerms);
@DELETE("/account/api/oauth/sessions/kill/{accessToken}")
Call<Void> killAuthSession(@Path("accessToken") String accessToken);
/**
* @param killType OTHERS, ALL_ACCOUNT_CLIENT, OTHERS_ACCOUNT_CLIENT, OTHERS_ACCOUNT_CLIENT_SERVICE
*/
@DELETE("/account/api/oauth/sessions/kill")
Call<Void> killAuthSessions(@Query("killType") String killType);
@GET("/account/api/public/account")
Call<GameProfile[]> queryUserInfo(@Query("accountId") List<String> ids);
@GET("/account/api/public/account/{id}")
Call<XGameProfile> queryUserInfo(@Path("id") String id);
@GET("/account/api/accounts/{id}/metadata")
Call<JsonObject> queryUserMetaData(@Path("id") String id);
@GET("/account/api/public/account/{accountId}/deviceAuth")
Call<DeviceAuth[]> queryDeviceAuths(@Path("accountId") String accountId);
@GET("/account/api/public/account/{accountId}/deviceAuth/{deviceId}")
Call<DeviceAuth> queryDeviceAuths(@Path("accountId") String accountId, @Path("deviceId") String deviceId);
@POST("/account/api/public/account/{accountId}/deviceAuth")
Call<DeviceAuth> createDeviceAuth(@Path("accountId") String accountId, @Header("X-Epic-Device-Info") String deviceInfo);
@DELETE("/account/api/public/account/{accountId}/deviceAuth/{deviceId}")
Call<Void> deleteDeviceAuth(@Path("accountId") String accountId, @Path("deviceId") String deviceId);
@GET("/account/api/public/account/{id}/externalAuths")
Call<ExternalAuth[]> queryExternalAccounts(@Path("id") String id);
@GET("/account/api/public/account/{id}/externalAuths/{type}")
Call<ExternalAuth> queryExternalAccountsByType(@Path("id") String id, @Path("type") String type);
// TODO @POST("/account/api/public/account/{id}/externalAuths")
// JsonObject: authType, externalAuthToken
// Call<ExternalAuth[]> addExternalAccount(@Path("id") String id, @Body AddExternalAccountPayload payload);
@DELETE("/account/api/public/account/{id}/externalAuths/{type}")
Call<Void> removeExternalAccount(@Path("id") String id, @Path("type") String type);
@GET("/account/api/public/account/displayName/{name}")
Call<GameProfile> queryUserIdFromDisplayName(@Path("name") String name);
@GET("/account/api/public/account/email/{email}")
Call<GameProfile> queryUserIdFromEmail(@Path("email") String email);
@POST("/account/api/public/account/lookup/externalId")
Call<Map<String, ExternalAuth>> queryExternalIdMappingsById(@Body QueryExternalIdMappingsByIdPayload payload);
@GET("/account/api/public/account/lookup/externalAuth/{externalAuthType}/displayName/{displayName}")
Call<GameProfile[]> queryExternalIdMappingsByDisplayName(@Path("externalAuthType") String externalAuthType, @Path("displayName") String displayName, @Query("caseInsensitive") Boolean caseInsensitive);
@GET("/account/api/epicdomains/ssodomains")
Call<String[]> querySSODomains();
}
package com.tb24.fn.network;
import com.google.gson.JsonElement;
import com.tb24.fn.model.AccountCompetitiveData;
import com.tb24.fn.model.EventDownloadResponse;
import com.tb24.fn.model.LeaderboardsResponse;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface EventsPublicService {
String BASE_URL = "https://events-public-service-live.ol.epicgames.com";
/**
* @param gameId "Fortnite"
* @param accountId "00112233445566778899aabbccddeeff"
* @param regionId "ASIA"
* @param platformName "Windows"
* @param teamAccountIds "00112233445566778899aabbccddeeff"
*/
@GET("/api/v1/events/{GameId}/download/{AccountId}")
Call<EventDownloadResponse> download(@Path("GameId") String gameId, @Path("AccountId") String accountId, @Query("region") String regionId, @Query("platform") String platformName, @Query("teamAccountIds") String teamAccountIds);
/**
* TODO haven't tried
*
* @param gameId "Fortnite"
* @param accountId "00112233445566778899aabbccddeeff"
* @param regionId "ASIA"
* @param bShowPastEvents ???
*/
@GET("/api/v1/events/{GameId}/data/{AccountId}")
Call<JsonElement> data(@Path("GameId") String gameId, @Path("AccountId") String accountId, @Query("region") String regionId, @Query("showPastEvents") Boolean bShowPastEvents);
/**
* TODO haven't tried
*
* @param gameId "Fortnite"
* @param eventId "epicgames_OnlineOpen_Week2_ASIA"
* @param eventWindowId "OnlineOpen_Week2_ASIA_Event2"
*/
@GET("/api/v1/events/{GameId}/{EventId}/{EventWindowId}/history")
Call<JsonElement> history(@Path("GameId") String gameId, @Path("EventId") String eventId, @Path("EventWindowId") String eventWindowId);
/**
* @param gameId "Fortnite"
* @param eventId "epicgames_OnlineOpen_Week2_ASIA"
* @param eventWindowId "OnlineOpen_Week2_ASIA_Event2"
* @param accountId "00112233445566778899aabbccddeeff"
* @param page 0
* @param rank 0
* @param teamAccountIds ""
* @param appId "Fortnite"
* @param bShowLiveSessions "false"
*/
@GET("/api/v1/leaderboards/{GameId}/{EventId}/{EventWindowId}/{AccountId}")
Call<LeaderboardsResponse> leaderboards(@Path("GameId") String gameId, @Path("EventId") String eventId, @Path("EventWindowId") String eventWindowId, @Path("AccountId") String accountId, @Query("page") Integer page, @Query("rank") Integer rank, @Query("teamAccountIds") String teamAccountIds, @Query("appId") String appId, @Query("showLiveSessions") Boolean bShowLiveSessions);
/**
* @param gameId "Fortnite"
* @param accountId "00112233445566778899aabbccddeeff"
*/
@GET("/api/v1/players/{GameId}/{AccountId}")
Call<AccountCompetitiveData> eventDataForAccount(@Path("GameId") String gameId, @Path("AccountId") String accountId);
/**
* TODO return object
*
* @param gameId "Fortnite"
* @param eventId "epicgames_OnlineOpen_Week2_ASIA"
* @param accountId "00112233445566778899aabbccddeeff"
*/
@GET("/api/v1/events/{GameId}/{EventId}/history/{AccountId}")
Call<JsonElement[]> eventHistoryForAccount(@Path("GameId") String gameId, @Path("EventId") String eventId, @Path("AccountId") String accountId);
/**
* TODO haven't tried
*
* @param gameId "Fortnite"
* @param eventId "epicgames_OnlineOpen_Week2_ASIA"
* @param eventWindowId "OnlineOpen_Week2_ASIA_Event2"
* @param accountId "00112233445566778899aabbccddeeff"
*/
@GET("/api/v1/events/{GameId}/{EventId}/{EventWindowId}/history/{AccountId}")
Call<JsonElement[]> eventWindowHistoryForAccount(@Path("GameId") String gameId, @Path("EventId") String eventId, @Path("EventWindowId") String eventWindowId, @Path("AccountId") String accountId);
}
package com.tb24.fn.network;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.tb24.fn.model.AccountPrivacyResponse;
import com.tb24.fn.model.CalendarTimelineResponse;
import com.tb24.fn.model.FortCatalogResponse;
import com.tb24.fn.model.FortMcpResponse;
import com.tb24.fn.model.LinkEntry;
import com.tb24.fn.model.LinksQueryResponse;
import com.tb24.fn.model.QueryMultipleUserStats;
import com.tb24.fn.model.Receipt;
import com.tb24.fn.model.StatsV2Response;
import com.tb24.fn.model.WorldInfoResponse;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface FortnitePublicService {
String BASE_URL = "https://fortnite-public-service-prod11.ol.epicgames.com";
@POST("/fortnite/api/game/v2/profile/{id}/client/{command}")
Call<FortMcpResponse> clientCommand(@Path("command") String command, @Path("id") String accountId, @Query("profileId") String profileId, @Query("rvn") Integer currentProfileRevision, @Header("X-EpicGames-ProfileRevisions") String profileRevisionsMeta, @Body Object payload);
@GET("/fortnite/api/game/v2/world/info")
Call<WorldInfoResponse> pveWorldInfo();
@GET("/fortnite/api/game/v2/privacy/account/{id}")
Call<AccountPrivacyResponse> getAccountPrivacy(@Path("id") String id);
@POST("/fortnite/api/game/v2/privacy/account/{id}")
Call<AccountPrivacyResponse> setAccountPrivacy(@Path("id") String id, @Body AccountPrivacyResponse payload);
@GET("/fortnite/api/storefront/v2/catalog")
Call<FortCatalogResponse> storefrontCatalog();
@GET("/fortnite/api/calendar/v1/timeline")
Call<CalendarTimelineResponse> calendarTimeline();
@GET("/fortnite/api/statsv2/account/{id}")
Call<StatsV2Response> querySingleUserStats(@Path("id") String id, @Query("startTime") Long startTime, @Query("endTime") Long endTime);
@POST("/fortnite/api/statsv2/query")
Call<StatsV2Response[]> queryMultipleUserStats(@Body QueryMultipleUserStats payload);
@GET("/fortnite/api/cloudstorage/user/{id}")
Call<JsonObject[]> enumerateUserFiles(@Path("id") String id);
@POST("/fortnite/api/game/v2/events/v2/processPendingRewards/{id}")
Call<JsonElement[]> eventsProcessPendingRewards(@Path("id") String id);
@GET("/fortnite/api/game/v2/tryPlayOnPlatform/account/{id}")
Call<Boolean> tryPlayOnPlatform(@Path("id") String id, @Query("platform") String platform);
@GET("/fortnite/api/game/v2/enabled_features")
Call<JsonElement[]> enabledFeatures();
@POST("/fortnite/api/game/v2/grant_access/{id}")
Call<Void> grantAccess(@Path("id") String id);
@GET("/fortnite/api/storefront/v2/keychain")
Call<String[]> storefrontKeychain(@Query("numKeysDownloaded") Integer numKeysDownloaded);
@GET("/fortnite/api/receipts/v1/account/{id}/receipts")
Call<Receipt[]> receipts(@Path("id") String id);
/**
* @param olderThan in ISO 8601 date format
*/
@GET("/fortnite/api/game/v2/creative/favorites/{accountId}")
Call<LinksQueryResponse> queryCreativeFavorites(@Path("accountId") String accountId, @Query("limit") Integer limit, @Query("olderThan") String olderThan);
@PUT("/fortnite/api/game/v2/creative/favorites/{accountId}/{mnemonic}")
Call<LinkEntry> addCodeToCreativeFavorites(@Path("accountId") String accountId, @Path("mnemonic") String mnemonic);
/**
* Requires permission fortnite:profile:MissingParameterValue:commands DELETE
*/
@DELETE("/fortnite/api/game/v2/creative/favorites/{accountId}/{mnemonic}")
Call<Void> removeCodeFromCreativeFavorites(@Path("accountId") String accountId, @Path("mnemonic") String mnemonic);
/**
* @param olderThan in ISO 8601 date format
*/
@GET("/fortnite/api/game/v2/creative/history/{accountId}")
Call<LinksQueryResponse> queryCreativeHistory(@Path("accountId") String accountId, @Query("limit") Integer limit, @Query("olderThan") String olderThan);
/**
* Requires permission fortnite:fortnite_role:dedicated_server ALL
*/
@PUT("/fortnite/api/game/v2/creative/history/{accountId}/{mnemonic}")
Call<LinkEntry> addCodeToCreativeHistory(@Path("accountId") String accountId, @Path("mnemonic") String mnemonic);
@DELETE("/fortnite/api/game/v2/creative/history/{accountId}/{mnemonic}")
Call<Void> removeCodeFromCreativeHistory(@Path("accountId") String accountId, @Path("mnemonic") String mnemonic);
@GET("/fortnite/api/storefront/v2/gift/check_eligibility/recipient/{recipientAccountId}/offer/{offerId}")
Call<Void> checkGiftEligibility(@Path("recipientAccountId") String recipientAccountId, @Path("offerId") String offerId);
}
package com.tb24.fn.network;
import com.tb24.fn.model.BlockedUsers;
import com.tb24.fn.model.Friend;
import com.tb24.fn.model.FriendsSettings;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface FriendsPublicService {
String BASE_URL = "https://friends-public-service-prod.ol.epicgames.com";
@GET("/friends/api/public/friends/{id}")
Call<Friend[]> friends(@Path("id") String id, @Query("includePending") Boolean includePending);
@POST("/friends/api/public/friends/{id}/{friend}")
Call<Void> inviteOrAccept(@Path("id") String id, @Path("friend") String friend);
@DELETE("/friends/api/public/friends/{id}/{friend}")
Call<Void> removeOrReject(@Path("id") String id, @Path("friend") String friend);
@GET("/friends/api/public/blocklist/{id}")
Call<BlockedUsers> blockList(@Path("id") String id);
// @GET("/friends/api/public/blocklist/{id}/{block}")
// Call<Friend> blockList(@Path("id") String id, @Path("block") String block);
@GET("/friends/api/public/list/{namespace}/{id}/recentPlayers")
Call<Friend[]> recentPlayers(@Path("namespace") String namespace, @Path("id") String id);
@GET("/friends/api/v1/{id}/settings")
Call<FriendsSettings> settings(@Path("id") String id);
@PUT("/friends/api/v1/{id}/settings")
Call<FriendsSettings> setSettings(@Path("id") String id, @Body FriendsSettings newSettings);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment