BagelDBRequest class
The builder for creating a bagelDB request, follow the builder pattern with the verbs get, put, post and delete building and executing the request. There is also the ability to use the uploadImage builder, for uploading images to an item
Constructors
Properties
- bagelDB → BagelDB
-
final
- baseEndpoint → String
-
final
- callEverything ↔ bool
-
getter/setter pair
- collectionID ↔ String
-
getter/setter pair
- dioInitialized ↔ bool
-
getter/setter pair
- dioInstance ↔ Dio
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- liveEndpoint → String
-
final
-
nestedCollectionsIDs
↔ List<
String> -
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sortField ↔ String
-
getter/setter pair
- sortOrder ↔ String
-
getter/setter pair
Methods
-
aggregationPipeline(
List< Map< mongoAggPipeline) → BagelDBRequestString, dynamic> > -
Use the
Aggregation Pipeline
to use a mongodb query format -
append(
dynamic fieldSlug, dynamic value) → Future< BagelResponse> - Append a reference to an ItemRef field to avoid having to put the enire array This halps avoid conflicts between different clients
-
collection(
dynamic collectionSlug) → BagelDBRequest - GET, PUT and POST to nested collections
-
delete(
) → Future< BagelResponse> - Build and execute a delete request to bagelDB.
-
everything(
) → BagelDBRequest - specify whether the request should include all the details for item references
-
find(
Object mongoQueryObj) → BagelDBRequest - Use find to use a mongodb query format
-
get(
) → Future< BagelResponse> - Build and execute a get request to bagelDB, for both full collection and item requests
-
item(
String _id) → BagelDBRequest -
defines the request for a specific item by the item's
_id
either in top level collection or in nested collection -
listen(
dynamic onData(BagelEvent)) → Future< StreamSubscription< Uint8List> ?> - Trigger a callback when an item gets updated created or deleted on BagelDB on a full collection or on a single item
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pageNumber(
int? pageNumber) → BagelDBRequest - define the pageNumber - the index of the page
-
perPage(
int resultsPerPage) → BagelDBRequest -
define the
resultsPerPage
- how many results will be in each page -
post(
Map< String, dynamic> item) → Future<BagelResponse> -
Build and execute a post request to bagelDB.
item
should follow the collection schema as defined at app.bageldb.com -
projectOff(
dynamic slugs) → BagelDBRequest - Remove the feields you want to remove from the payload to reduce the payload size and imrove efficeincy Project on cannot be used togher with projectOn they are mutually exclusive
-
projectOn(
dynamic slugs) → BagelDBRequest - Select only the fields you want the fields you want to receive by using a comma seperated list Project on cannot be used togher with projectOff they are mutually exclusive
-
put(
Map< String, dynamic> item) → Future<BagelResponse> -
Build and execute a put request to bagelDB.
item
should follow the collection schema as defined at app.bageldb.com -
query(
String key, String queryOperator, dynamic value) → BagelDBRequest -
quering the collection with a
key
andvalue
parameters, by thequeryOperator
. The following are valid queryOperators '=', '!=', 'regex', '>', '<'. The value can also be a comma seperated list of values, allowing for an 'in' query. For example:query('age', '=', '32')
or for an itemRef queryquery('position.itemRefID', '=', '[432EWDWE]')
-
set(
Map< String, dynamic> item) → Future<BagelResponse> - Set an item in order to determine the id of the item yourself. in the event the itemID already exists, set() will simply update the exising item
-
sort(
String sortField, {String? sortOrder}) → BagelDBRequest -
sort data by
sortTerm
- a specific field, for exampleage
, and bysortField
-desc
for descending order,asc
for ascending order. -
toString(
) → String -
A string representation of this object.
inherited
-
unset(
dynamic fieldSlug, dynamic value) → Future< BagelResponse> - Unset simply removes a reference to an ItemRef field avoid having to put the enire array This halps avoid conflicts between different clients
-
uploadImage(
String slug, File image) → Future< BagelResponse> -
Build and execute a image upload to bagelDB, for a specific item in a collection.
image
should be a valid file object andslug
is the field to which the image will be updated. The item() methods must have been used in order to execute uploadImage
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited