Model that manages the creation of chat topics.

Hierarchy (view full)

Constructors

Properties

onNewTopicEvent: OEvent<(() => void)> = ...

Notify the user whenever a new topic is created or received.

onUpdated: OEvent<(() => void)> = ...
state: StateMachine<"Uninitialised" | "Initialised", "shutdown" | "init">
EVERYONE_TOPIC_ID: "EveryoneTopic" = 'EveryoneTopic'
GLUE_TOPIC_ID: "GlueOneTopic" = 'GlueOneTopic'

Accessors

  • get topics(): Omit<default, "add" | "remove">
  • Retrieves the topic registry. Omit the add & remove functions from the public API. The model takes care of those things.

    Returns Omit<default, "add" | "remove">

Methods

  • Share the given topic with the desired group.

    Parameters

    • groupIdHash: SHA256IdHash<Group>
    • topic: Topic

    Returns Promise<void>

  • Share the given topic with the desired persons.

    Parameters

    • participants: SHA256IdHash<Person>[]
    • topic: Topic

    Returns Promise<void>

  • Creates the default everyone topic if it does not exist.

    Note: Access rights will be automatically given to the "leute everyone" group by the addTopicToRegistry hook, that listens for new Topic objects.

    Returns Promise<Topic>

  • Creates the one.glue topic if it does not exist.

    Note: Access rights will be automatically given to the "leute everyone" group by the addTopicToRegistry hook, that listens for new Topic objects.

    Returns Promise<Topic>

  • Creates group topic (multiplePerson)

    Parameters

    • topicName: string
    • OptionaltopicId: string
    • OptionalchannelOwner: SHA256IdHash<Person>

    Returns Promise<Topic>

  • Creates one to one topic (person to person)

    Note: Access rights will be automatically given to the participants by the addTopicToRegistry hook, that listens for new Topic objects.

    Parameters

    • from: SHA256IdHash<Person>
    • to: SHA256IdHash<Person>
    • OptionalchannelOwner: SHA256IdHash<Person>

      Optional. One of from, to or undefined (default)

    Returns Promise<Topic>

  • Get participants of a 1:1 topic.

    Parameters

    • topicId: string

    Returns [SHA256IdHash<Person>, SHA256IdHash<Person>]

  • Get participants of a 1:1 topic, but return my identity first if I am a participant.

    Parameters

    • topicId: string

    Returns Promise<[SHA256IdHash<Person>, SHA256IdHash<Person>]>

  • Return whether the topicId refers to the everyone chat or not.

    Parameters

    • topicId: string

    Returns boolean

  • Return whether the topicId refers to the one.glue chat or not.

    Parameters

    • topicId: string

    Returns boolean

  • Return whether the topicId refers to a 1:1 chat or not.

    Parameters

    • topicId: string

    Returns boolean