Package group24.escaperoom.data
Class Networking
java.lang.Object
group24.escaperoom.data.Networking
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattemptLoginAPI(User user, String password) Networking API call to log in to an existing user.createUserAPI(User user, String password) Networking API call to create a new user.downloadMapMetadata(String mapID, String destination) Networking API call to download a maps metadata.downloadMapThumbnail(String mapID, String destination) Networking API call to download a maps thumbnail.downloadUserMap(String mapID, String destination) Networking API call to download a user map.getPlayerRecord(String username) Networking API call to post a player record Preconditions: - user must be logged in Returns anPlayerRecordResponsewhich contains a success code and potentialPlayerRecord.static CompletableFuture<group24.escaperoom.data.Networking.RequestResponse>HttpMultipartPost(String url, group24.escaperoom.data.Networking.MultipartFields fields, boolean isAuthenticated) listMapMetadata(Types.ListMapsRequest request) Networking API call to list published maps' metadata.Networking API call to list global player records Preconditions: - user must be logged in Returns anListPlayerRecordRequestwhich contains a success code and potential array of records.static CompletableFuture<group24.escaperoom.data.Networking.RequestResponse>sendMapClear(String mapID, long clearTime) Networking API call to register a map completion.updateMapStats(String mapID, com.badlogic.gdx.utils.Array<MapMetadata.MapStats.ValidStats> stats) Networking API call to send map stat updates.updatePlayerRecord(PlayerRecord record) Networking API call to post a player record Preconditions: - user must be logged in ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: erroruploadUserMap(MapMetadata.MapLocation locations, String metadata) Networking API call to upload a user map.userExists(User user) Networking API call to check if a user exists.userExists(String username) Networking API call to check if a user exists.
-
Constructor Details
-
Networking
public Networking()
-
-
Method Details
-
postJson
public static CompletableFuture<group24.escaperoom.data.Networking.RequestResponse> postJson(String url, String json, boolean isAuthenticated) -
HttpMultipartPost
public static CompletableFuture<group24.escaperoom.data.Networking.RequestResponse> HttpMultipartPost(String url, group24.escaperoom.data.Networking.MultipartFields fields, boolean isAuthenticated) -
createUserAPI
Networking API call to create a new user. Requires: - user.username - password Updates User parameter on success: - clears password - sets player_id - sets access_key ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
attemptLoginAPI
Networking API call to log in to an existing user. Requires: - user.username - password Updates User parameter on success: - clears password - sets player_id - sets access_key ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
userExists
Networking API call to check if a user exists. Requires: - user.username ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
userExists
Networking API call to check if a user exists. ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
uploadUserMap
public static CompletableFuture<Networking.UploadResponse> uploadUserMap(MapMetadata.MapLocation locations, String metadata) Networking API call to upload a user map. Preconditions: - user must be logged in Requires: - path to folder containing map data - json string of metadata for the map Returns anUploadResponsewhich contains a success code and potential map ID. If theUploadResponse.codeisStatusCode.OK, then the map ID exists and is valid. Otherwise, the upload failed and there is no map ID provided. -
downloadUserMap
public static CompletableFuture<Networking.StatusCode> downloadUserMap(String mapID, String destination) Networking API call to download a user map. Requires: - id of the map to download ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
listMapMetadata
public static CompletableFuture<Types.ListMapsResponse> listMapMetadata(Types.ListMapsRequest request) Networking API call to list published maps' metadata. Preconditions: - user must be logged in Requires: - id of the map cleared - cleartime in ms ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
listPlayerRecords
public static CompletableFuture<Types.ListPlayerRecordResponse> listPlayerRecords(Types.ListPlayerRecordRequest request) Networking API call to list global player records Preconditions: - user must be logged in Returns anListPlayerRecordRequestwhich contains a success code and potential array of records. If theListPlayerRecordResponse.codeisStatusCode.OK, then the array exists and is valid. Otherwise, the fetch failed and there is no array provided. -
sendMapClear
Networking API call to register a map completion. Preconditions: - user must be logged in Requires: - id of the map cleared - cleartime in ms ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
updateMapStats
public static CompletableFuture<Networking.StatusCode> updateMapStats(String mapID, com.badlogic.gdx.utils.Array<MapMetadata.MapStats.ValidStats> stats) Networking API call to send map stat updates. Preconditions: - user must be logged in Requires: - id of the map to update - list of stats to increase. all given will increase by 1 ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
downloadMapMetadata
public static CompletableFuture<Networking.StatusCode> downloadMapMetadata(String mapID, String destination) Networking API call to download a maps metadata. Preconditions: - user must be logged in Requires: - id of the map to query ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
downloadMapThumbnail
public static CompletableFuture<Networking.StatusCode> downloadMapThumbnail(String mapID, String destination) Networking API call to download a maps thumbnail. Preconditions: - user must be logged in Requires: - id of the map to query ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
updatePlayerRecord
Networking API call to post a player record Preconditions: - user must be logged in ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
getPlayerRecord
Networking API call to post a player record Preconditions: - user must be logged in Returns anPlayerRecordResponsewhich contains a success code and potentialPlayerRecord. If thePlayerRecordResponse.codeisStatusCode.OK, then the records exists and is valid. Otherwise, the fetch failed and there is no record provided.
-