import 'dart:convert';
+import 'package:flempires/webService.dart';
import 'package:http/http.dart' as http;
class Player {
);
}
+// static Resource<List<NewsArticle>> get all {
+//
+// return Resource(
+// url: Constants.HEADLINE_NEWS_URL,
+// parse: (response) {
+// final result = json.decode(response.body);
+// Iterable list = result['articles'];
+// return list.map((model) => NewsArticle.fromJson(model)).toList();
+// }
+// );
+//
+// }
+
+// static Request<List<Player>> get all (String code) {
+//
+// }
+
+ static Request<List<Player>> get all {
+ return Request(
+ url: 'https://families.cworth.org/api/players',
+ type: 'Player',
+ parse: (response) {
+ final result = json.decode(response.body);
+ Iterable list = result['players'];
+ return list.map((model) => Player.fromJson(model)).toList();
+ });
+ }
+
static Future<Player> fetchFirstPlayer() async {
final response = await http.get('https://families.cworth.org/api/players');