updateResource method
Future<ResourceUpdated>
updateResource(
- String type,
- String id, {
- Map<
String, Object?> attributes = const {}, - Map<
String, Identifier> one = const {}, - Map<
String, Iterable< many = const {},Identifier> > - Map<
String, Object?> meta = const {}, - Map<
String, Object?> documentMeta = const {}, - Map<
String, List< headers = const {},String> > - Iterable<
QueryEncodable> query = const [],
Updates the resource identified by type
and id
.
Optional arguments:
attributes
- attributes to updateone
- to-one relationships to updatemany
- to-many relationships to updatemeta
- resource meta data to updatedocumentMeta
- document meta dataheaders
- any extra HTTP headersquery
- a collection of parameters to be included in the URI query
Implementation
Future<ResourceUpdated> updateResource(
String type,
String id, {
Map<String, Object?> attributes = const {},
Map<String, Identifier> one = const {},
Map<String, Iterable<Identifier>> many = const {},
Map<String, Object?> meta = const {},
Map<String, Object?> documentMeta = const {},
Map<String, List<String>> headers = const {},
Iterable<QueryEncodable> query = const [],
}) async =>
ResourceUpdated(await send(
_baseUri.resource(type, id),
Request.patch(OutboundDataDocument.resource(Resource(type, id)
..attributes.addAll(attributes)
..relationships.addAll({
...one.map((key, value) => MapEntry(key, ToOne(value))),
...many.map((key, value) => MapEntry(key, ToMany(value))),
})
..meta.addAll(meta))
..meta.addAll(documentMeta))
..headers.addAll(headers)
..query.mergeAll(query)));