This commit is contained in:
thosakwe 2017-02-12 14:58:18 -05:00
parent 05c79d1660
commit f73b802392
5 changed files with 7 additions and 10 deletions

View file

@ -1,6 +1,6 @@
# angel_client
[![pub 1.0.0-dev+22](https://img.shields.io/badge/pub-1.0.0--dev+22-red.svg)](https://pub.dartlang.org/packages/angel_client)
[![pub 1.0.0-dev+23](https://img.shields.io/badge/pub-1.0.0--dev+23-red.svg)](https://pub.dartlang.org/packages/angel_client)
![build status](https://travis-ci.org/angel-dart/client.svg)
Client library for the Angel framework.

View file

@ -90,7 +90,7 @@ abstract class Service {
Angel get app;
/// Retrieves all resources.
Future<List> index([Map params]);
Future index([Map params]);
/// Retrieves the desired resource.
Future read(id, [Map params]);

View file

@ -229,7 +229,7 @@ class BaseAngelService extends Service {
}
@override
Future<List> index([Map params]) async {
Future index([Map params]) async {
final response = await app.sendUnstreamed(
'GET', '$basePath/${_buildQuery(params)}', _readHeaders);
@ -239,11 +239,7 @@ class BaseAngelService extends Service {
}
final json = JSON.decode(response.body);
if (json is! List) {
throw failure(response);
}
if (json is! List) return json;
return json.map(deserialize).toList();
} catch (e, st) {
throw failure(response, error: e, stack: st);

View file

@ -47,8 +47,9 @@ class RestService extends BaseAngelService {
}
@override
Future<List> index([Map params]) async {
Future index([Map params]) async {
final items = await super.index(params);
if (items is! List) return items;
return items.map(deserialize).toList();
}

View file

@ -1,5 +1,5 @@
name: angel_client
version: 1.0.0-dev+22
version: 1.0.0-dev+23
description: Client library for the Angel framework.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_client