Skip to content

Commit

Permalink
Add ChannelMessagesList function to the runtimes.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed May 21, 2022
1 parent 11ae5d0 commit e804a8e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Add custom metrics publishing functions to Lua and JavaScript runtimes.
- Add missing "sessionLogout" TypeScript definition.
- Add "FriendsBlock" function to the runtimes.
- Add "ChannelMessagesList" function to the runtimes.

### Changed
- Fix naming of delete notifications before/after hook registration functions.
Expand Down
12 changes: 12 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4289,6 +4289,18 @@ declare namespace nkruntime {
*/
channelMessageUpdate(channelId: string, messageId: string, content?: {[key: string]: any}, senderId?: string, senderUsername?: string, persist?: boolean): ChannelMessageSendAck

/**
* List channel messages.
*
* @param channelId - Channel ID.
* @param limit - The number of messages to return per page.
* @param forward - Whether to list messages from oldest to newest, or newest to oldest.
* @param cursor - Opt. Pagination cursor.
* @returns List of channel messages.
* @throws {TypeError, GoError}
*/
channelMessagesList(channelId: string, limit?: number, forward?: boolean, cursor?: string): ChannelMessageList

/**
* Send channel message.
*
Expand Down
1 change: 1 addition & 0 deletions runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1061,4 +1061,5 @@ type NakamaModule interface {
ChannelIdBuild(ctx context.Context, sender string, target string, chanType ChannelType) (string, error)
ChannelMessageSend(ctx context.Context, channelID string, content map[string]interface{}, senderId, senderUsername string, persist bool) (*rtapi.ChannelMessageAck, error)
ChannelMessageUpdate(ctx context.Context, channelID, messageID string, content map[string]interface{}, senderId, senderUsername string, persist bool) (*rtapi.ChannelMessageAck, error)
ChannelMessagesList(ctx context.Context, channelId string, limit int, forward bool, cursor string) (messages []*api.ChannelMessage, nextCursor string, prevCursor string, err error)
}

0 comments on commit e804a8e

Please sign in to comment.