Home > @i2analyze/i2connect > services > IResult > addLink
services.IResult.addLink() method
Adds a new link record to the result, whose identifier is a source identifier that you create.
Signature:
addLink<TLinkType extends schema.ILinkType, TFromEnd extends records.ISeededResultEntityRecord | records.IResultEntityRecord, TToEnd extends records.ISeededResultEntityRecord | records.IResultEntityRecord>(type: TLinkType, id: records.ISourceIdentifier, fromEnd: TFromEnd, toEnd: TToEnd, direction?: data.LinkDirection): records.IResultLinkRecord<TLinkType, TFromEnd, TToEnd, records.ISourceIdentifier>;
Introduced: API version 2.0
Type Parameters
Parameter | Type | Description |
---|---|---|
TLinkType | extends schema.ILinkType | The type of the new link record. |
TFromEnd | extends records.ISeededResultEntityRecord | records.IResultEntityRecord | The type of the entity record at the "from" end of the link. |
TToEnd | extends records.ISeededResultEntityRecord | records.IResultEntityRecord | The type of the entity record at the "to" end of the link. |
Parameters
Parameter | Type | Description |
---|---|---|
type | TLinkType | The link type of the new record. |
id | records.ISourceIdentifier | A source identifier for the new record. |
fromEnd | TFromEnd | The entity record for the "from" end of the link, which was previously returned from services.IResult.addEntity() or services.IResult.addEntityFromSeed(). |
toEnd | TToEnd | The entity record for the "to" end of the link, which was previously returned from services.IResult.addEntity() or services.IResult.addEntityFromSeed(). |
direction | data.LinkDirection | (Optional) The direction of the new link record, which defaults to "none" . |
Returns:
records.IResultLinkRecord<TLinkType, TFromEnd, TToEnd, records.ISourceIdentifier>
The link record that was added to the result.