Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add friend metadata support. #169

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 friend metadata support.

## [1.35.0] - 2024-11-25
### Added
Expand Down
2,310 changes: 1,166 additions & 1,144 deletions api/api.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ message AddFriendsRequest {
repeated string ids = 1;
// The account username of a user.
repeated string usernames = 2;
// Optional metadata to add to friends.
string metadata = 3;
}

// Add users to a group.
Expand Down Expand Up @@ -422,6 +424,8 @@ message Friend {
google.protobuf.Int32Value state = 2; // one of "Friend.State".
// Time of the latest relationship update.
google.protobuf.Timestamp update_time = 3;
// Metadata.
string metadata = 4;
}

// A collection of zero or more friends of the user.
Expand Down
10 changes: 10 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4774,6 +4774,16 @@ declare namespace nkruntime {
*/
userGroupsList(userId: string, limit?: number, state?: number, cursor?: string): UserGroupList;

/**
* Update friend metadata.
*
* @param userId - User ID.
* @param friendUserId - Friend User ID.
* @param metadata - Metadata to set. Overwrites existing metadata.
* @throws {TypeError, GoError}
*/
friendMetadataUpdate(userId: string, friendUserId: string, metadata: {[key: string]: any}): void;

/**
* List a user's friends.
*
Expand Down
2 changes: 1 addition & 1 deletion rtapi/realtime.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1196,9 +1196,10 @@ type NakamaModule interface {
GroupsGetRandom(ctx context.Context, count int) ([]*api.Group, error)
UserGroupsList(ctx context.Context, userID string, limit int, state *int, cursor string) ([]*api.UserGroupList_UserGroup, string, error)

FriendMetadataUpdate(ctx context.Context, userID string, friendUserId string, metadata map[string]any) error
FriendsList(ctx context.Context, userID string, limit int, state *int, cursor string) ([]*api.Friend, string, error)
FriendsOfFriendsList(ctx context.Context, userID string, limit int, cursor string) ([]*api.FriendsOfFriendsList_FriendOfFriend, string, error)
FriendsAdd(ctx context.Context, userID string, username string, ids []string, usernames []string) error
FriendsAdd(ctx context.Context, userID string, username string, ids []string, usernames []string, metadata map[string]any) error
FriendsDelete(ctx context.Context, userID string, username string, ids []string, usernames []string) error
FriendsBlock(ctx context.Context, userID string, username string, ids []string, usernames []string) error

Expand Down
Loading