addMany method

Future<RelationshipUpdated<ToMany>> addMany(
  1. String type,
  2. String id,
  3. String relationship,
  4. List<Identifier> identifiers, {
  5. Map<String, Object?> meta = const {},
  6. Map<String, String> headers = const {},
})

Adds identifiers to a to-many relationship identified by type, id, relationship.

Optional arguments:

  • headers - any extra HTTP headers

Implementation

Future<RelationshipUpdated<ToMany>> addMany(
  String type,
  String id,
  String relationship,
  List<Identifier> identifiers, {
  Map<String, Object?> meta = const {},
  Map<String, String> headers = const {},
}) async {
  final response = await send(
      baseUri.relationship(type, id, relationship),
      Request.post(
          OutboundDataDocument.many(ToMany(identifiers)..meta.addAll(meta)))
        ..headers.addAll(headers));
  return RelationshipUpdated.many(response.http, response.document);
}