2016-06-24 00:25:11 +00:00
|
|
|
/// Client library for the Angel framework.
|
|
|
|
library angel_client;
|
|
|
|
|
|
|
|
import 'dart:async';
|
2016-06-24 19:02:35 +00:00
|
|
|
import 'dart:convert' show JSON;
|
|
|
|
import 'package:http/http.dart';
|
|
|
|
part 'rest.dart';
|
|
|
|
|
|
|
|
|
|
|
|
/// Represents an Angel server that we are querying.
|
|
|
|
abstract class Angel {
|
|
|
|
String basePath;
|
|
|
|
|
|
|
|
Angel(String this.basePath);
|
|
|
|
Service service(Pattern path);
|
|
|
|
}
|
2016-06-24 00:25:11 +00:00
|
|
|
|
|
|
|
/// Queries a service on an Angel server, with the same API.
|
|
|
|
abstract class Service {
|
|
|
|
/// Retrieves all resources.
|
|
|
|
Future<List> index([Map params]);
|
|
|
|
|
|
|
|
/// Retrieves the desired resource.
|
|
|
|
Future read(id, [Map params]);
|
|
|
|
|
|
|
|
/// Creates a resource.
|
|
|
|
Future create(data, [Map params]);
|
|
|
|
|
|
|
|
/// Modifies a resource.
|
|
|
|
Future modify(id, data, [Map params]);
|
|
|
|
|
|
|
|
/// Overwrites a resource.
|
|
|
|
Future update(id, data, [Map params]);
|
|
|
|
|
|
|
|
/// Removes the given resource.
|
|
|
|
Future remove(id, [Map params]);
|
|
|
|
}
|