Javascript SDK

EntityLink

Reference an entity.

const entityLink = {
  entity: "alice.baq.run",
};

Static methods

  • new(entity: Entity): EntityLink

    • Create a new entity link from a user entity.

Properties

  • entity Entity

    • Entity currently representing the target user.
  • originalEntity Entity optional

    • Target user’s entity at the time the record version was created, if different.

Once created, an entity link can be used in the content of a record. In this example we create a Post record­ that mentions other users with the help of entity links.

import {EntityLink} from "@baqhub/sdk";
import {PostRecord} from "./baq/postRecord.js";

const entityLink1 = EntityLink.new("henry.baq.run");
const entityLink2 = EntityLink.new("sean.baq.run");

const postRecord = PostRecord.new("paul.baq.run", {
  text: "Where are you going this weekend? @henry.baq.run @sean.baq.run",
  textMentions: [
    {mention: entityLink1, index: 34, length: 14},
    {mention: entityLink2, index: 49, length: 13},
  ],
});
© 2024 Quentez