Class Networking

java.lang.Object
group24.escaperoom.data.Networking

public class Networking extends Object
  • 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

      public static CompletableFuture<Networking.StatusCode> createUserAPI(User user, String password)
      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 Returns StatusCode for success/fail handling: - StatusCode.OK: success - anything else: error
    • attemptLoginAPI

      public static CompletableFuture<Networking.StatusCode> attemptLoginAPI(User user, String password)
      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 Returns StatusCode for success/fail handling: - StatusCode.OK: success - anything else: error
    • userExists

      public static CompletableFuture<Networking.StatusCode> userExists(User user)
      Networking API call to check if a user exists. Requires: - user.username Returns StatusCode for success/fail handling: - StatusCode.OK: success - anything else: error
    • userExists

      public static CompletableFuture<Networking.StatusCode> userExists(String username)
      Networking API call to check if a user exists. Returns StatusCode for 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 an UploadResponse which contains a success code and potential map ID. If the UploadResponse.code is StatusCode.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 Returns StatusCode for 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 Returns StatusCode for success/fail handling: - StatusCode.OK: success - anything else: error
    • listPlayerRecords

      Networking API call to list global player records Preconditions: - user must be logged in Returns an ListPlayerRecordRequest which contains a success code and potential array of records. If the ListPlayerRecordResponse.code is StatusCode.OK, then the array exists and is valid. Otherwise, the fetch failed and there is no array provided.
    • sendMapClear

      public static CompletableFuture<Networking.StatusCode> sendMapClear(String mapID, long clearTime)
      Networking API call to register a map completion. Preconditions: - user must be logged in Requires: - id of the map cleared - cleartime in ms Returns StatusCode for 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 Returns StatusCode for 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 Returns StatusCode for 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 Returns StatusCode for success/fail handling: - StatusCode.OK: success - anything else: error
    • updatePlayerRecord

      public static CompletableFuture<Networking.StatusCode> updatePlayerRecord(PlayerRecord record)
      Networking API call to post a player record Preconditions: - user must be logged in Returns StatusCode for success/fail handling: - StatusCode.OK: success - anything else: error
    • getPlayerRecord

      public static CompletableFuture<Types.PlayerRecordResponse> getPlayerRecord(String username)
      Networking API call to post a player record Preconditions: - user must be logged in Returns an PlayerRecordResponse which contains a success code and potential PlayerRecord. If the PlayerRecordResponse.code is StatusCode.OK, then the records exists and is valid. Otherwise, the fetch failed and there is no record provided.