Closed QuinnBast closed 4 years ago
Updated API module to work with the latest backend updates.
Problems with creating a message group. See https://github.com/Subterfuge-Revived/Remake-Backend/issues/28
These commits should fix up everything that was mentioned
The "enforced tempalte [sic] type" commit secretly contains other changes ;-) But I approve of them so you have my blessing 👍
Description
Additional Flexibility
Updated the
Api
class to include more detailed information about network requests. THeApi
now wraps all responses in aNetworkResponse<T>
class. The templated class, T, is the class representation of the JSON object that is returned from the response. When the network response is returned, if a failure occurs, theNetworkResponse
object now stores the originalHttpResponseMessage
as well as the raw string content of the request and the status code. This makes it easier for the frontend to be able to handle various failure cases. If the response is a success, theNetworkResponse
class will attempt to cast the JSON string in the response into the templated type, T. If unsuccessfully able to cast to the templated type, anull
object is set in theNetworkResponse.Response
object.This change also changes the API's URL to be a
static
member. This means that you no longer have to callApi api = new Api(serverUrl)
, you can simply set the URL once and it will remember the URL. This resolves #9New Endpoints
Multiple new endpoints were also added to the
Api
class which reflect the backend API's endpoints. These endpoints include the ability to block other players, create group chats, as well as send and receive messages from a group. This resolves #8Type of change
CLI
Core
Testing
Checklist:
This module contains breaking changes to Unity users. However, the respective changes to the Unity dll have been made on an appropraite branch and should be merged in to master when this PR is accepted.