FirestoreClientService class

Manipulates data from Firestore as Maps.

Inheritance

Constructors

FirestoreClientService(CollectionReference collection, {bool allowRemoveAll: false})

Properties

allowRemoveAll bool
If set to true, clients can remove all items by passing a null id to remove. [...]
final
app Angel
The Angel app powering this service.
read / write, inherited
bootstrappers List<RequestHandler>
Handlers that must run to ensure this service's functionality.
read-only, inherited
collection CollectionReference
read / write
configuration Map
final, inherited
container Container
A Container used to inject dependencies.
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
middleware List<RequestHandler>
read-only, inherited
mounted Map<Pattern, Router<RequestHandler>>
read-only, inherited
onService Stream<Service>
Fired whenever a service is added to this instance. [...]
read-only, inherited
readData FutureOr<Map<String, dynamic>> Function(RequestContext, ResponseContext)
A Function that reads the request body and converts it into Data.
read-only, inherited
routes List<Route<RequestHandler>>
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
services Map<Pattern, Service>
A set of Service objects that have been mapped into routes.
read-only, inherited

Methods

addRoute(String method, String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route<RequestHandler>
Adds a route that responds to the given path for requests with the given method (case-insensitive). Provide '*' as the method to respond to all methods.
inherited
addRoutes([Service service]) → void
Generates RESTful routes pointing to this class's methods.
inherited
all(String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route<RequestHandler>
Adds a route that responds to any request matching the given path.
inherited
chain(Iterable<RequestHandler> middleware) → _ChainedRouter<RequestHandler>
Prepends the given middleware to any routes created by the resulting router. [...]
inherited
clone() Router<RequestHandler>
Returns a Router with a duplicated version of this tree.
inherited
close() → void
Closes this service, including any database connections or stream controllers.
inherited
create(Map<String, dynamic> data, [Map<String, dynamic> params]) Future<Map<String, dynamic>>
POST / Create a resource. This endpoint should return
override
delete(String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route<RequestHandler>
Adds a route that responds to a DELETE request.
inherited
dumpTree({dynamic callback(String tree), String header: 'Dumping route tree:', String tab: ' '}) → void
Creates a visual representation of the route hierarchy and passes it to a callback. If none is provided, print is called.
inherited
enableCache() → void
Enables the use of a cache to eliminate the overhead of consecutive resolutions of the same path.
inherited
findHookedService<T extends Service>(Pattern path) HookedService<dynamic, dynamic, T>
Shorthand for finding a HookedService in a statically-typed manner.
inherited
findOne([Map<String, dynamic> params, String errorMessage = 'No record was found matching the given query.']) Future<Map<String, dynamic>>
If the result of index is null, OR an empty Iterable, a 404 AngelHttpException will be thrown. If the result is both non-null and NOT an Iterable, it will be returned as-is. If the result is a non-empty Iterable, findOne will return it.first, where it is the aforementioned Iterable. A custom errorMessage may be provided
override
findService<T extends Service>(Pattern path) → T
Retrieves the service assigned to the given path.
inherited
findServiceOf<Id, Data>(Pattern path) Service<Id, Data>
Shorthand for finding a Service in a statically-typed manner.
inherited
get(String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route<RequestHandler>
Adds a route that responds to a GET request.
inherited
group(String path, void callback(Router<RequestHandler> router), {Iterable<RequestHandler> middleware, String name}) SymlinkRoute<RequestHandler>
Creates a route, and allows you to add child routes to it via a Router instance. [...]
inherited
groupAsync(String path, FutureOr<void> callback(Router<RequestHandler> router), {Iterable<RequestHandler> middleware, String name}) Future<SymlinkRoute<RequestHandler>>
Asynchronous equivalent of group.
inherited
Adds a route that responds to a HEAD request.
inherited
index([Map<String, dynamic> params]) Future<List<Map<String, dynamic>>>
GET / Fetch all resources. Usually returns a List.
override
map<U>(U encoder(Map<String, dynamic>), Map<String, dynamic> decoder(U), {FutureOr<U> readData(RequestContext, ResponseContext)}) Service<String, U>
Creates an AnonymousService that wraps over this one, and maps input and output using two converter functions. [...]
inherited
modify(String id, Map<String, dynamic> data, [Map<String, dynamic> params]) Future<Map<String, dynamic>>
PATCH /:id Modifies a resource. Clients can submit only the data they want to change, and the corresponding resource will have only those fields changed. This endpoint should return the modified resource.
override
mount(String path, Router<RequestHandler> router) SymlinkRoute<RequestHandler>
Incorporates another Router's routes into this one's.
inherited
Generates a URI string based on the given input. Handy when you have named routes. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onHooked(HookedService<dynamic, dynamic, Service> hookedService) → void
Invoked when this service is wrapped within a HookedService.
inherited
options(String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route<RequestHandler>
Adds a route that responds to a OPTIONS request.
inherited
patch(String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route<RequestHandler>
Adds a route that responds to a PATCH request.
inherited
post(String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route<RequestHandler>
Adds a route that responds to a POST request.
inherited
put(String path, RequestHandler handler, {Iterable<RequestHandler> middleware}) Route
Adds a route that responds to a PUT request.
inherited
read(String id, [Map<String, dynamic> params]) Future<Map<String, dynamic>>
GET /:id Fetch one resource, by its ID
override
readMany(List<String> ids, [Map<String, dynamic> params]) Future<List<Map<String, dynamic>>>
Reads multiple resources at once.
override
remove(String id, [Map<String, dynamic> params]) Future<Map<String, dynamic>>
DELETE /:id Deletes a resource. This endpoint should return the deleted resource.
override
resolve(String absolute, String relative, List<RoutingResult<RequestHandler>> out, {String method: 'GET', bool strip: true}) bool
Finds the first Route that matches the given path, with the given method.
inherited
resolveAbsolute(String path, {String method: 'GET', bool strip: true}) Iterable<RoutingResult<RequestHandler>>
Returns the result of resolve with path passed as both absolute and relative.
inherited
resolveAll(String absolute, String relative, {String method: 'GET', bool strip: true}) Iterable<RoutingResult<RequestHandler>>
Finds every possible Route that matches the given path, with the given method.
inherited
toString() String
Returns a string representation of this object.
inherited
update(String id, Map<String, dynamic> data, [Map<String, dynamic> params]) Future<Map<String, dynamic>>
POST /:id Overwrites a resource. The existing resource is completely replaced by the new data. This endpoint should return the new resource.
override
use<Id, Data, T extends Service<Id, Data>>(String path, T service) HookedService<Id, Data, T>
Mounts a service at the given path. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited