diff --git a/CHANGELOG.md b/CHANGELOG.md index 3308c43..fc4c76d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/index.d.ts b/index.d.ts index 030e78b..cd9c87c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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; @@ -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[] @@ -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[] @@ -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. * diff --git a/runtime/runtime.go b/runtime/runtime.go index 90a269f..c2d6672 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -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