... | ... | @@ -2,7 +2,7 @@ |
|
|
In order to access the actual database via the game server, the app client has to communicate with the server. This is done using the AkamuAPI class (`V2API.java`). In it, a collection of functions can be found which do the actual network calls. This is done using a REST API ([OkHttp](https://square.github.io/okhttp/)). Functions for doing PUT/GET/POST/DELETE/PATCH requests are provided. Furthermore it holds the server url, the token and a few [interceptors](https://square.github.io/okhttp/interceptors/) for easier logging and error handling.
|
|
|
|
|
|
**Accessing the API**
|
|
|
The app uses the MVP pattern ([see](Development/Development Using MVP Pattern)) for passing data from the datasource to the view and vice versa. The API calls are executed asynchronously in the datasource. However there is a further abstraction layer between AkamuAPI and the datasources. The classes in this layer follow the naimg convention V2APIXYZ where XYZ defines some kind of grouping of calls which execute similar or corresponding actions. E.g. there is the `V2APIUser `class which is responsible for all kinds of calls that deal with the app user model i.e. getting all users, one specific user and updating the user. Let's take the example from our ([MVP tutorial](Development/Development Using MVP Pattern)). The datasource called `V2APIUser.updateUser(patchUser)`. What happens here? Let's take a look at the implementation of `V2APIUser`:
|
|
|
The app uses the MVP pattern ([see](2.1Development Using MVP Pattern)) for passing data from the datasource to the view and vice versa. The API calls are executed asynchronously in the datasource. However there is a further abstraction layer between AkamuAPI and the datasources. The classes in this layer follow the naimg convention V2APIXYZ where XYZ defines some kind of grouping of calls which execute similar or corresponding actions. E.g. there is the `V2APIUser `class which is responsible for all kinds of calls that deal with the app user model i.e. getting all users, one specific user and updating the user. Let's take the example from our ([MVP tutorial](2.1Development Using MVP Pattern)). The datasource called `V2APIUser.updateUser(patchUser)`. What happens here? Let's take a look at the implementation of `V2APIUser`:
|
|
|
|
|
|
```
|
|
|
public final class V2APIUser {
|
... | ... | |