getDocument method

Future getDocument(
  1. String? id, [
  2. String? rev,
  3. bool withAttachments = false
])

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.

Implementation

Future<dynamic> getDocument(String? id,
    [String? rev, bool withAttachments = false]) {
  if (id == null) {
    return _raiseException(WiltException.getDocNoId);
  }

  var url = id;
  if (rev != null) {
    url = _setURLParameter(url, 'rev', rev);
  }

  if (withAttachments) {
    url = _setURLParameter(url, 'attachments', 'true');
  }

  url = _conditionUrl(url);
  return _httpRequest('GET_DOCUMENT', url);
}