Add <Id, Data>
This commit is contained in:
parent
ae5acd1a9c
commit
20c6aedaa3
1 changed files with 10 additions and 10 deletions
|
@ -51,7 +51,7 @@ class Providers {
|
||||||
/// A front-facing interface that can present data to and operate on data on behalf of the user.
|
/// A front-facing interface that can present data to and operate on data on behalf of the user.
|
||||||
///
|
///
|
||||||
/// Heavily inspired by FeathersJS. <3
|
/// Heavily inspired by FeathersJS. <3
|
||||||
class Service extends Routable {
|
class Service<Id, Data> extends Routable {
|
||||||
/// A [List] of keys that services should ignore, should they see them in the query.
|
/// A [List] of keys that services should ignore, should they see them in the query.
|
||||||
static const List<String> specialQueryKeys = <String>[
|
static const List<String> specialQueryKeys = <String>[
|
||||||
r'$limit',
|
r'$limit',
|
||||||
|
@ -102,27 +102,27 @@ class Service extends Routable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the desired resource.
|
/// Retrieves the desired resource.
|
||||||
Future read(id, [Map params]) {
|
Future read(Id id, [Map params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a resource.
|
/// Creates a resource.
|
||||||
Future create(data, [Map params]) {
|
Future create(Data data, [Map params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Modifies a resource.
|
/// Modifies a resource.
|
||||||
Future modify(id, data, [Map params]) {
|
Future modify(Id id, Data data, [Map params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Overwrites a resource.
|
/// Overwrites a resource.
|
||||||
Future update(id, data, [Map params]) {
|
Future update(Id id, Data data, [Map params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes the given resource.
|
/// Removes the given resource.
|
||||||
Future remove(id, [Map params]) {
|
Future remove(Id id, [Map params]) {
|
||||||
throw new AngelHttpException.methodNotAllowed();
|
throw new AngelHttpException.methodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ class Service extends Routable {
|
||||||
return req.parseBody().then((body) {
|
return req.parseBody().then((body) {
|
||||||
return this
|
return this
|
||||||
.create(
|
.create(
|
||||||
body,
|
body as Data,
|
||||||
mergeMap([
|
mergeMap([
|
||||||
{'query': query},
|
{'query': query},
|
||||||
restProvider,
|
restProvider,
|
||||||
|
@ -229,7 +229,7 @@ class Service extends Routable {
|
||||||
return req.parseQuery().then((query) {
|
return req.parseQuery().then((query) {
|
||||||
return this.modify(
|
return this.modify(
|
||||||
parseId(req.params['id']),
|
parseId(req.params['id']),
|
||||||
body,
|
body as Data,
|
||||||
mergeMap([
|
mergeMap([
|
||||||
{'query': query},
|
{'query': query},
|
||||||
restProvider,
|
restProvider,
|
||||||
|
@ -250,7 +250,7 @@ class Service extends Routable {
|
||||||
return req.parseQuery().then((query) {
|
return req.parseQuery().then((query) {
|
||||||
return this.update(
|
return this.update(
|
||||||
parseId(req.params['id']),
|
parseId(req.params['id']),
|
||||||
body,
|
body as Data,
|
||||||
mergeMap([
|
mergeMap([
|
||||||
{'query': query},
|
{'query': query},
|
||||||
restProvider,
|
restProvider,
|
||||||
|
@ -268,7 +268,7 @@ class Service extends Routable {
|
||||||
return req.parseQuery().then((query) {
|
return req.parseQuery().then((query) {
|
||||||
return this.update(
|
return this.update(
|
||||||
parseId(req.params['id']),
|
parseId(req.params['id']),
|
||||||
body,
|
body as Data,
|
||||||
mergeMap([
|
mergeMap([
|
||||||
{'query': query},
|
{'query': query},
|
||||||
restProvider,
|
restProvider,
|
||||||
|
|
Loading…
Reference in a new issue