Update Service Client authored by Andrew Januszko's avatar Andrew Januszko
s
\ No newline at end of file
# What is the Service Client?
The service client is a template for an asynchronous restful communications api which allows us to communicate with the main FreshmanRPG project. It takes in a String called `baseURL` which tells it which server to target. It also has two type definitions called JSON and HEADER. `JSON` is an alias for `Map<String, dynamic>` and `HEADER` is an alias for `Map<String, String>`.
```dart
abstract class ServiceClient {
final String baseURL;
const ServiceClient({
required this.baseURL,
});
///
/// Template for a get method.
///
Future<JSON> get({
required String endpoint,
HEADER? headers,
});
///
/// Template for a post method.
///
Future<JSON> post({
required String endpoint,
HEADER? headers,
required JSON body,
});
}
```
For more information about restful apis, check [here](https://www.restapitutorial.com/lessons/httpmethods.html).
\ No newline at end of file