updateAttachment method
Update an attachment on an existing document. contentType is in the form of a mime type e.g. 'image/png'
Implementation
Future<dynamic> updateAttachment(String? docId, String? attachmentName,
String? rev, String? contentType, String? payload) {
// Check all parameters are supplied
if (docId == null) {
return _raiseException(WiltException.updateAttNoDocId);
}
if (attachmentName == null) {
return _raiseException(WiltException.updateAttNoName);
}
if (rev == null) {
return _raiseException(WiltException.updateAttNoRev);
}
if (contentType == null) {
return _raiseException(WiltException.updateAttNoContentType);
}
if (payload == null) {
return _raiseException(WiltException.updateAttNoPayload);
}
// Set the headers
final headers = <String, String>{};
headers['Content-Type'] = contentType;
var url = '$docId/$attachmentName?rev=$rev';
url = _conditionUrl(url);
return _httpRequest(updateAttachmentt, url,
data: payload, headers: headers);
}