addThread method

String addThread(
  1. String channelId,
  2. String title, {
  3. required String createdBy,
})

Adds a thread to channelId and returns its ID.

Implementation

String addThread(
  String channelId,
  String title, {
  required String createdBy,
}) {
  final id = nextId();
  threads[id] = {
    'id': id,
    'channel_id': channelId,
    'kind': 'thread',
    'title': title,
    'title_source': 'manual',
    'state': 'open',
    'last_message_seq': 0,
    'last_activity_at': stamp(),
    'message_count': 0,
    'created_by': createdBy,
    'created_at': stamp(),
    'version': 1,
    'tag_ids': <Object?>[],
  };
  _threadMessages[id] = [];
  return id;
}