replaceToMany method

Future<RelationshipUpdated<ToMany>> replaceToMany(
  1. String type,
  2. String id,
  3. String relationship,
  4. Iterable<Identifier> identifiers, {
  5. Map<String, Object?> meta = const {},
  6. Map<String, List<String>> headers = const {},
  7. Iterable<QueryEncodable> query = const [],
})

Replaces the to-many relationship identified by type, id, and relationship by setting the new identifiers.

Optional arguments:

  • meta - relationship metadata
  • headers - any extra HTTP headers
  • query - a collection of parameters to be included in the URI query

Implementation

Future<RelationshipUpdated<ToMany>> replaceToMany(
  String type,
  String id,
  String relationship,
  Iterable<Identifier> identifiers, {
  Map<String, Object?> meta = const {},
  Map<String, List<String>> headers = const {},
  Iterable<QueryEncodable> query = const [],
}) async {
  final response = await send(
      _baseUri.relationship(type, id, relationship),
      Request.patch(
          OutboundDataDocument.many(ToMany(identifiers)..meta.addAll(meta)))
        ..headers.addAll(headers)
        ..query.mergeAll(query));
  return RelationshipUpdated.many(response.httpResponse, response.document);
}