Channel
Query format
[user designation], [channel kinds] [with unread]?
Query syntax
current user, all|common local|global
current user, given local|global [self, org, managed, direct, inbox, dispatch]
given user [id], (qualifier)
<all above> with unread
Only query the channel categories that are needed for the application.
Common: direct, self, org
All:
The given user
phrase will only work via the admin interface. The org
query covers org, ad-hoc and group channels. Others are mapped directly to the channel kind.
Adding with unread
will return only the channels with unread data and will include unread count.
Response
The response is a list of ChannelInfo objects.
Object interface
id
: Stringstatus
: Option[String]name
: Option[String]kind
: direct|org|managed|self|ad*hoc|group|dispatchcreatedAt
: Option[DateTime]lastRead
: Option[DateTime]position
: Option[Long]lastWrite
: Option[DateTime]lastMessage
: Option[String]unreadCount
: Option[Long]**orgId
: Option[SafeUuid]orgName
: Option[String]setting
: Option[String]icon
: Option[String]ownerId
: Option[String]linkedChannelId
: Option[SafeUuid]editPermission
: Option[String]writePermission
: Option[String]managedStatus
: Option[String]managedLatest
: Option[DateTime]
** unreadCount will only be returned if with unread
is specified.
General usage
To get all channels for the local org
current user, all local
To get all local channels with unread messages
current user, all local with unread
To get all channels with unread messages for any org
current user, all global with unread
It is also possible to get specific sets of channels
current user, given local [self, org, managed, direct]
Dispatch will be added as a channel category.
Examples
Returns channels for the current org that have unread counts
current user, all local with unread
Returns all channels for the current org
current user, all local
Unified query interface
To simplify the interface for getting lists of channels. The interface is available on both the user and admin GraphQL interface as channelQuery
and takes a query parameter which is required.
In general the pattern should be:
- At startup request the list of channels that the UI needs to display, e.g.
current user, given local [org, direct]
- At startup retrieve the unread count via
current user, all local with unread
.. this will exclude channels that do not have any unread numbers. - When a screen specific display is needed show that list, e.g.
current user, given local [dispatch]
ORcurrent user, given local [managed]
- When channel read position is updated OR new packets come in a further debounced call to
current user, all local with unread
to get the updated unread counts. Note that this information will get sent over the socket soon to further reduce the server query needs. - If a global unread count is desired use
current user, all global with unread