Commit e2b38a40 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Pagination for friends, user groups, and group users listings.

parent 277fdfa3
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -7,17 +7,29 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
### Added
- Allow RPC functions to receive and return raw JSON data.
- Status follow operations now also accept usernames to follow.
- Pagination support for friends listing operations.
- Filtering by friend state in friends listing operations.
- Pagination support for group users listing operations.
- Filtering by user state in group users listing operations.
- Pagination support for user groups listing operations.
- Filtering by group state in user groups listing operations.

### Changed
- Update devconsole lodash (4.17.13) and lodash.template (4.5.0) dependencies.
- Errors from runtime before hooks no longer close the session.
- Switch prometheus metrics to use labels instead of a prefix.
- Add flag on realtime socket messages that will support optional reliability.
- Friends listing pages are now limited to max 100 results each.
- Group users listing pages are now limited to max 100 results each.
- User groups listing pages are now limited to max 100 results each.
- Group users listing now includes disabled (banned) users.
- User groups listing now includes disabled groups.

### Fixed
- Handle updates during leaderboard schedule reset window.
- Ensure the matchmaker cannot match together tickets from the same session.
- Handle leaderboard deletes shortly before a scheduled reset.
- Listing user groups no longer returns an error when the user is a member of zero groups.

## [2.6.0] - 2019-07-01
### Added
+432 −288

File changed.

Preview size limit exceeded, changes collapsed.

+32 −4
Original line number Diff line number Diff line
@@ -319,9 +319,11 @@ message Friend {
}

// A collection of zero or more friends of the user.
message Friends {
message FriendList {
  // The Friend objects.
  repeated Friend friends = 1;
  // Cursor for the next page of results, if any.
  string cursor = 2;
}

// Fetch a batch of zero or more users from the server.
@@ -394,6 +396,8 @@ message GroupUserList {

  // User-role pairs for a group.
  repeated GroupUser group_users = 1;
  // Cursor for the next page of results, if any.
  string cursor = 2;
}

// Import Facebook friends into the current user's account.
@@ -456,9 +460,9 @@ message LeaderboardRecord {
message LeaderboardRecordList {
  // A list of leaderboard records.
  repeated LeaderboardRecord records = 1;
  // A batched set of leaderobard records belonging to specified owners.
  // A batched set of leaderboard records belonging to specified owners.
  repeated LeaderboardRecord owner_records = 2;
  // The cursor to send when retireving the next page, if any.
  // The cursor to send when retrieving the next page, if any.
  string next_cursor = 3;
  // The cursor to send when retrieving the previous page, if any.
  string prev_cursor = 4;
@@ -490,6 +494,16 @@ message ListChannelMessagesRequest {
  string cursor = 4;
}

// List friends for a user.
message ListFriendsRequest {
  // Max number of records to return. Between 1 and 100.
  google.protobuf.Int32Value limit = 1;
  // The friend state to list.
  google.protobuf.Int32Value state = 2;
  // An optional next page cursor.
  string cursor = 3;
}

// List groups based on given filters.
message ListGroupsRequest {
  // List groups that contain this value in their names.
@@ -504,6 +518,12 @@ message ListGroupsRequest {
message ListGroupUsersRequest {
  // The group ID to list from.
  string group_id = 1;
  // Max number of records to return. Between 1 and 100.
  google.protobuf.Int32Value limit = 2;
  // The group user state to list.
  google.protobuf.Int32Value state = 3;
  // An optional next page cursor.
  string cursor = 4;
}

// List leaerboard records from a given leaderboard around the owner.
@@ -614,6 +634,12 @@ message ListTournamentsRequest {
message ListUserGroupsRequest {
  // ID of the user.
  string user_id = 1;
  // Max number of records to return. Between 1 and 100.
  google.protobuf.Int32Value limit = 2;
  // The user group state to list.
  google.protobuf.Int32Value state = 3;
  // An optional next page cursor.
  string cursor = 4;
}

// Represents a realtime match.
@@ -752,7 +778,7 @@ message StorageObjects {
message StorageObjectList {
  // The list of storage objects.
  repeated StorageObject objects = 1;
  // The cursor associated with the query a page of results.
  // The cursor for the next page of results, if any.
  string cursor = 2;
}

@@ -906,6 +932,8 @@ message UserGroupList {

  // Group-role pairs for a user.
  repeated UserGroup user_groups = 1;
  // Cursor for the next page of results, if any.
  string cursor = 2;
}

// A collection of zero or more users.
+132 −131

File changed.

Preview size limit exceeded, changes collapsed.

+34 −1
Original line number Diff line number Diff line
@@ -785,10 +785,21 @@ func request_Nakama_ListChannelMessages_0(ctx context.Context, marshaler runtime

}

var (
	filter_Nakama_ListFriends_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)

func request_Nakama_ListFriends_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq empty.Empty
	var protoReq api.ListFriendsRequest
	var metadata runtime.ServerMetadata

	if err := req.ParseForm(); err != nil {
		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
	}
	if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Nakama_ListFriends_0); err != nil {
		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
	}

	msg, err := client.ListFriends(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

@@ -814,6 +825,10 @@ func request_Nakama_ListGroups_0(ctx context.Context, marshaler runtime.Marshale

}

var (
	filter_Nakama_ListGroupUsers_0 = &utilities.DoubleArray{Encoding: map[string]int{"group_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)

func request_Nakama_ListGroupUsers_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq api.ListGroupUsersRequest
	var metadata runtime.ServerMetadata
@@ -836,6 +851,13 @@ func request_Nakama_ListGroupUsers_0(ctx context.Context, marshaler runtime.Mars
		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "group_id", err)
	}

	if err := req.ParseForm(); err != nil {
		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
	}
	if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Nakama_ListGroupUsers_0); err != nil {
		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
	}

	msg, err := client.ListGroupUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

@@ -1162,6 +1184,10 @@ func request_Nakama_ListTournamentRecordsAroundOwner_0(ctx context.Context, mars

}

var (
	filter_Nakama_ListUserGroups_0 = &utilities.DoubleArray{Encoding: map[string]int{"user_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)

func request_Nakama_ListUserGroups_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq api.ListUserGroupsRequest
	var metadata runtime.ServerMetadata
@@ -1184,6 +1210,13 @@ func request_Nakama_ListUserGroups_0(ctx context.Context, marshaler runtime.Mars
		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user_id", err)
	}

	if err := req.ParseForm(); err != nil {
		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
	}
	if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Nakama_ListUserGroups_0); err != nil {
		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
	}

	msg, err := client.ListUserGroups(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

Loading