Wilt class

The Wilt client.

  • The Wilt class provides core functionality for interacting with CouchDB databases from both the browser and the server.

Constructors

Wilt(String host, {int port = 5984, bool useSSL = false})
Please use the wilt_browser_client or wilt_server_client import files to instantiate a Wilt object for use in either the browser or server environment. You can do this here but you must supply either a browser or server HTTP adapter to use.

Properties

authenticationType String
Authentication, type
getter/setter pair
changeNotification Stream<WiltChangeNotificationEvent>
Change notification event stream This is a broadcast stream so can support more than one listener.
no setter
changeNotificationDbName String?
Change notification database name
getter/setter pair
changeNotificationsPaused bool
Change notification paused state
no setter
completionResponse → JsonObjectLite?
no setter
db String?
Database name
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
host String
Domain name or IP address of couchdb server
final
port int
Port number, defaults to 5984 (the couchdb default)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useSSL bool
Use SSL when connecting to couchdb, defaults to false
final

Methods

bulk(List<JsonObjectLite> docs, [bool allOrNothing = false]) Future
Bulk insert Bulk inserts a list of documents
bulkString(String docs, [bool allOrNothing = false]) Future
Bulk insert json string version. Must be used if '_id' and or '_rev' are needed in ANY of the documents
copyDocument(String? sourceId, String? destinationId, [String? rev]) Future
Copies the source document to the destination document with an optional revision. NOTE this method uses the CouchDB COPY method which is not standard HTTP.
createAttachment(String? docId, String? attachmentName, String? rev, String? contentType, String? payload) Future
Create an attachment on an existing document. contentType is in the form of a mime type e.g. 'image/png' If the document needs to be created as well as the attachment set the rev to ''.
createDatabase(String? name) Future
Creates a database with the specified name.
delete(String? url) Future
Performs a HTTP DELETE operation,, the URL is conditioned and the current database added.
deleteAttachment(String? docId, String? attachmentName, String? rev) Future
Delete an attachment
deleteDatabase(String? name) Future
Deletes the specified database
deleteDocument(String? id, String? rev, [bool preserve = false]) Future
DELETE's the specified document. Must have a revision. If preserve is set to true the whole document is preserved and marked as deleted otherwise only a stub document is kept. Default is to not preserve.
doHttpRequest(String method, String url, [String? data, Map<String, String> headers = const {}]) Future
Processes the HTTP request, returning the server's response as a future
generateIds([int amount = 10]) Future
Ask CouchDB to generate document Id's.
get(String? url) Future
Performs an HTTP GET operation, the URL is conditioned and the current database added.
getAllDbs() Future
Get all the databases from CouchDB
getAllDocs({bool includeDocs = false, int? limit, String? startKey, String? endKey, List<String>? keys, bool descending = false}) Future
Get all documents. The parameters should be self explanatory and are addative. Refer to the CouchDb documentation for further explanation.
getAttachment(String? docId, String? attachmentName) Future
Get an attachment
getDatabaseInfo([String? dbName]) Future
Get information about a database
getDocument(String? id, [String? rev, bool withAttachments = false]) Future
Performs an HTTP GET operation for the supplied document id and optional revision. If withAttachments is set the the body of any attachments are also supplied, note this could make this a large transfer.
getDocumentRevision(String? id) Future
Gets a documents current revision, returns null if the document does not exist.
getSession() Future
Get current session information from CouchDB
getStats() Future
Get current stats from CouchDB, 1.xx versions only
getString(String url) Future<String>
Specialised 'get' for change notifications
Performs a HTTP HEAD operation, the URL is conditioned and the current database added.
httpRequest(String url, {String method = 'GET'}) Future
Basic method where only a URL and a method is passed. Wilt applies no checks to this URL nor does it add the database, the format of this is entirely up to the user.
login(String? user, String? password) → void
Authentication. Updates the login credentials in Wilt that will be used for all further requests to CouchDB. Both user name and password must be set, even if one or the other is '' i.e empty. After logging in all communication with CouchDB is made using the selected authentication method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notificationAuthParams(String? user, String? password, String authType) → void
Authentication parameters for change notification
pauseChangeNotifications() → void
Pause change notifications
post(String? url, String data, [Map<String, String>? headers]) Future
Performs a HTTP POST operation,, the URL is conditioned and the current database added.
postDocument(JsonObjectLite? document, {String? path}) Future
POST's the specified document. An optional path to the document can be specified.
postDocumentString(String? document, {String? path}) Future
POST's to the specified document where the document is supplied as a json string. Must be used if '_id' and or '_rev' are needed.
put(String? url, String data, [Map<String, String>? headers]) Future
Performs a HTTP PUT operation,, the URL is conditioned and the current database added.
putDocument(String? id, JsonObjectLite? document, [String? rev]) Future
PUT's to the specified document.
putDocumentString(String id, String document, [String? rev]) Future
PUT's to the specified document where the document is supplied as a json string. Must be used if '_id' and or '_rev' are needed.
restartChangeNotifications() → void
Restart change notifications after a pause
startChangeNotification([WiltChangeNotificationParameters? parameters, String? databaseName]) → void
Change notification start, see the WiltChangeNotification class for more details.
stopChangeNotification() → void
Change notification stop, see the WiltChangeNotification class for more details
toString() String
A string representation of this object.
inherited
updateAttachment(String? docId, String? attachmentName, String? rev, String? contentType, String? payload) Future
Update an attachment on an existing document. contentType is in the form of a mime type e.g. 'image/png'
updateChangeNotificationParameters(WiltChangeNotificationParameters parameters) → void
Change the parameter set for change notifications.

Operators

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

Constants

alldbs → const String
URL constant for CouchDB ALLDBS function
alldocs → const String
URL constant for CouchDB ALLDOCS function
authBasic → const String
AUTH_BASIC denotes Basic HTTP authentication. If login is called AUTH_BASIC is set, otherwise it defaults to AUTH_NONE
authNone → const String
No authentication
bulkdocs → const String
URL constant for CouchDB BULKDOCS function
bulkk → const String
bulkStringg → const String
copy → const String
copyDocumentt → const String
createAttachmentt → const String
createDatabasee → const String
databaseInfo → const String
deleteAttachmentt → const String
deleteDatabasee → const String
deleteDocumentt → const String
deletee → const String
etag → const String
Etag header
generateIdss → const String
getAllDbss → const String
getAllDocss → const String
getAttachmentt → const String
getDocumentt → const String
getSessionn → const String
getStatss → const String
gett → const String
Operation types and method definitions
headd → const String
postDocumentStringg → const String
postDocumentt → const String
postt → const String
putDocumentt → const String
putt → const String
session → const String
URL constant for CouchDB SESSION function
stats → const String
URL constant for CouchDB STATS function
updateAttachmentt → const String
uuids → const String
URL constant for CouchDB UUID function