createEdge method

Future<StatusResponse> createEdge(
  1. String sourceKref,
  2. String targetKref,
  3. String edgeType, {
  4. Map<String, String>? metadata,
  5. bool existsError = true,
})
inherited

Creates an edge between two revisions.

sourceKref is the source revision's kref URI. targetKref is the target revision's kref URI. edgeType is the type of relationship (use EdgeType constants). metadata is optional key-value pairs to attach. existsError controls whether to throw if edge exists (default: true).

Implementation

Future<StatusResponse> createEdge(
  String sourceKref,
  String targetKref,
  String edgeType, {
  Map<String, String>? metadata,
  bool existsError = true,
}) async {
  final request = CreateEdgeRequest()
    ..sourceRevisionKref = Kref(uri: sourceKref)
    ..targetRevisionKref = Kref(uri: targetKref)
    ..edgeType = edgeType
    ..existsError = existsError;
  if (metadata != null) {
    request.metadata.addAll(metadata);
  }
  return stub.createEdge(request, options: callOptions);
}