Skip to content

Commit

Permalink
Add new runtime function to get a list of user's friend status (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
sesposito authored Nov 21, 2024
1 parent 8c42e0a commit 13c2528
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project are documented below.
The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org).

## [Unreleased]
### Added
- Add new runtime function to get a list of user's friend status.

## [1.34.0] - 2024-10-21
### Added
Expand Down
13 changes: 13 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3693,6 +3693,7 @@ declare namespace nkruntime {
* Export user account data to JSON encoded string
*
* @param userId - Target account.
* @returns JSON string of account data.
* @throws {TypeError, GoError}
*/
accountExportId(userId: string): string;
Expand All @@ -3702,6 +3703,7 @@ declare namespace nkruntime {
*
* @param userIds - User IDs. Pass null to fetch by facebookIds only.
* @param facebookIds - Facebook IDs.
* @returns Array containing users data.
* @throws {TypeError, GoError}
*/
usersGetId(userIds: string[], facebookIds?: string[]): User[]
Expand All @@ -3710,6 +3712,7 @@ declare namespace nkruntime {
* Get user data by usernames.
*
* @param usernames - Usernames.
* @returns Array containing users data.
* @throws {TypeError, GoError}
*/
usersGetUsername(usernames: string[]): User[]
Expand All @@ -3722,6 +3725,16 @@ declare namespace nkruntime {
*/
usersGetRandom(count: number): User[]

/**
* Get user data for a given number of random users.
*
* @param userId - Caller user ID.
* @param userIds - Target users to check friendship status with.
* @returns Array containing users friend data.
* @throws {TypeError, GoError}
*/
usersGetFriendStatus(userId: string, userIds: string[]): Friend[]

/**
* Ban a group of users by id.
*
Expand Down
1 change: 1 addition & 0 deletions runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ type NakamaModule interface {

UsersGetId(ctx context.Context, userIDs []string, facebookIDs []string) ([]*api.User, error)
UsersGetUsername(ctx context.Context, usernames []string) ([]*api.User, error)
UsersGetFriendStatus(ctx context.Context, userID string, userIDs []string) ([]*api.Friend, error)
UsersGetRandom(ctx context.Context, count int) ([]*api.User, error)
UsersBanId(ctx context.Context, userIDs []string) error
UsersUnbanId(ctx context.Context, userIDs []string) error
Expand Down

0 comments on commit 13c2528

Please sign in to comment.