Unverified Commit b91e8fad authored by Simon Esposito's avatar Simon Esposito Committed by GitHub
Browse files

Add runtime functions to get and list leaderboards. (#625)

Fix UI leaderboard ID label
Add leaderboardsGetId runtime function.
Add leaderboardList runtime function.
Add PrevReset field to Leaderboard and Tournament.
Update leaderboard reset callback signature.
parent 4de305d6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
## [Unreleased]
### Added
- Add new groupsList runtime function.
- Add runtime leaderboardList and leaderboardsGetId functions.
- Add leaderboard/tournament prev_reset field.

### Changed
- Include ticket in party matchmaker add operation responses.
@@ -15,6 +17,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Log recovered panics in HTTP handler functions at error level rather than info.
- Add new langTag, members and open filters to the group listing API.
- Upgrade pgx to v4 for improved SQL performance.
- Change RegisterLeaderboardReset runtime function signature.

### Fixed
- Ensure all members are correctly listed in party info when there are multiple concurrent successful joins.
+7 −26
Original line number Diff line number Diff line
@@ -88,18 +88,12 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
service Nakama {
  // Add friends by ID or username to a user's account.
  rpc AddFriends (api.AddFriendsRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v2/friend",
      body: "*"
    };
    option (google.api.http).post = "/v2/friend";
  }

  // Add users to a group.
  rpc AddGroupUsers (api.AddGroupUsersRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v2/group/{group_id}/add",
      body: "*"
    };
    option (google.api.http).post = "/v2/group/{group_id}/add";
  }

  // Refresh a user's session using a refresh token retrieved from a previous authentication request.
@@ -272,17 +266,13 @@ service Nakama {

  // Ban a set of users from a group.
  rpc BanGroupUsers (api.BanGroupUsersRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post = "/v2/group/{group_id}/ban",
      body: "*"
    };
    option (google.api.http).post = "/v2/group/{group_id}/ban";
  }

  // Block one or more users by ID or username.
  rpc BlockFriends (api.BlockFriendsRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v2/friend/block",
      body: "*"
      post: "/v2/friend/block"
    };
  }

@@ -373,10 +363,7 @@ service Nakama {

  // Kick a set of users from a group.
  rpc KickGroupUsers (api.KickGroupUsersRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v2/group/{group_id}/kick",
      body: "*"
    };
    option (google.api.http).post = "/v2/group/{group_id}/kick";
  }

  // Leave a group the user is a member of.
@@ -528,18 +515,12 @@ service Nakama {

  // Promote a set of users in a group to the next role up.
  rpc PromoteGroupUsers (api.PromoteGroupUsersRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v2/group/{group_id}/promote",
      body: "*"
    };
    option (google.api.http).post = "/v2/group/{group_id}/promote";
  }

  // Demote a set of users in a group to the next role down.
  rpc DemoteGroupUsers (api.DemoteGroupUsersRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v2/group/{group_id}/demote",
      body: "*"
    };
    option (google.api.http).post = "/v2/group/{group_id}/demote";
  }

  // Get storage objects.
+21 −12
Original line number Diff line number Diff line
@@ -1610,30 +1610,30 @@
            "type": "string"
          },
          {
            "name": "langTag",
            "description": "Language tag filter.",
            "name": "cursor",
            "description": "Optional pagination cursor.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "members",
            "description": "Number of group members.",
            "name": "limit",
            "description": "Max number of groups to return. Between 1 and 100.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "cursor",
            "description": "Optional pagination cursor.",
            "name": "langTag",
            "description": "Language tag filter.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "limit",
            "description": "Max number of groups to return. Between 1 and 100.",
            "name": "members",
            "description": "Number of group members.",
            "in": "query",
            "required": false,
            "type": "integer",
@@ -3345,7 +3345,7 @@
          "description": "Optional record metadata."
        },
        "operator": {
          "$ref": "#/definitions/apiOverrideOperator",
          "$ref": "#/definitions/apiOperator",
          "description": "Operator override."
        }
      },
@@ -3369,7 +3369,7 @@
          "description": "A JSON object of additional properties (optional)."
        },
        "operator": {
          "$ref": "#/definitions/apiOverrideOperator",
          "$ref": "#/definitions/apiOperator",
          "description": "Operator override."
        }
      },
@@ -4097,7 +4097,7 @@
      },
      "description": "A collection of zero or more notifications."
    },
    "apiOverrideOperator": {
    "apiOperator": {
      "type": "string",
      "enum": [
        "NO_OVERRIDE",
@@ -4341,7 +4341,7 @@
        "sortOrder": {
          "type": "integer",
          "format": "int64",
          "description": "ASC or DESC sort mode of scores in the tournament."
          "description": "ASC (0) or DESC (1) sort mode of scores in the tournament."
        },
        "size": {
          "type": "integer",
@@ -4400,6 +4400,15 @@
          "type": "integer",
          "format": "int64",
          "description": "The UNIX time when the tournament start being active. A computed value."
        },
        "prevReset": {
          "type": "integer",
          "format": "int64",
          "description": "The UNIX time when the tournament was last reset. A computed value."
        },
        "operator": {
          "$ref": "#/definitions/apiOperator",
          "description": "Operator."
        }
      },
      "description": "A tournament on the server."
+113 −113
Original line number Diff line number Diff line
@@ -974,7 +974,7 @@
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleLeaderboardList"
              "$ref": "#/definitions/nakamaconsoleLeaderboardList"
            }
          },
          "default": {
@@ -997,7 +997,7 @@
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleLeaderboard"
              "$ref": "#/definitions/nakamaconsoleLeaderboard"
            }
          },
          "default": {
@@ -2466,117 +2466,6 @@
      },
      "description": "A console user session."
    },
    "consoleLeaderboard": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The ID of the leaderboard."
        },
        "title": {
          "type": "string",
          "description": "The title for the leaderboard."
        },
        "description": {
          "type": "string",
          "description": "The description of the leaderboard. May be blank."
        },
        "category": {
          "type": "integer",
          "format": "int64",
          "description": "The category of the leaderboard. e.g. \"vip\" could be category 1."
        },
        "sortOrder": {
          "type": "integer",
          "format": "int64",
          "description": "ASC or DESC sort mode of scores in the leaderboard."
        },
        "size": {
          "type": "integer",
          "format": "int64",
          "description": "The current number of players in the leaderboard."
        },
        "maxSize": {
          "type": "integer",
          "format": "int64",
          "description": "The maximum number of players for the leaderboard."
        },
        "maxNumScore": {
          "type": "integer",
          "format": "int64",
          "description": "The maximum score updates allowed per player for the current leaderboard."
        },
        "operator": {
          "type": "integer",
          "format": "int64",
          "title": "The operator of the leaderboard"
        },
        "endActive": {
          "type": "integer",
          "format": "int64",
          "description": "The UNIX time when the leaderboard stops being active until next reset. A computed value."
        },
        "resetSchedule": {
          "type": "string",
          "description": "Reset cron expression."
        },
        "metadata": {
          "type": "string",
          "description": "Additional information stored as a JSON object."
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the leaderboard was created."
        },
        "startTime": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the leaderboard will start."
        },
        "endTime": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the leaderboard will be stopped."
        },
        "duration": {
          "type": "integer",
          "format": "int64",
          "description": "Duration of the tournament in seconds."
        },
        "startActive": {
          "type": "integer",
          "format": "int64",
          "description": "The UNIX time when the leaderboard start being active. A computed value."
        },
        "joinRequired": {
          "type": "boolean",
          "description": "Join required."
        },
        "authoritative": {
          "type": "boolean",
          "description": "Authoritative."
        },
        "tournament": {
          "type": "boolean",
          "description": "Tournament."
        }
      },
      "description": "A leaderboard."
    },
    "consoleLeaderboardList": {
      "type": "object",
      "properties": {
        "leaderboards": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/consoleLeaderboard"
          },
          "description": "The list of leaderboards returned."
        }
      },
      "description": "A list of leaderboards."
    },
    "consoleMatchState": {
      "type": "object",
      "properties": {
@@ -3076,6 +2965,117 @@
      },
      "description": "Account information."
    },
    "nakamaconsoleLeaderboard": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The ID of the leaderboard."
        },
        "title": {
          "type": "string",
          "description": "The title for the leaderboard."
        },
        "description": {
          "type": "string",
          "description": "The description of the leaderboard. May be blank."
        },
        "category": {
          "type": "integer",
          "format": "int64",
          "description": "The category of the leaderboard. e.g. \"vip\" could be category 1."
        },
        "sortOrder": {
          "type": "integer",
          "format": "int64",
          "description": "ASC or DESC sort mode of scores in the leaderboard."
        },
        "size": {
          "type": "integer",
          "format": "int64",
          "description": "The current number of players in the leaderboard."
        },
        "maxSize": {
          "type": "integer",
          "format": "int64",
          "description": "The maximum number of players for the leaderboard."
        },
        "maxNumScore": {
          "type": "integer",
          "format": "int64",
          "description": "The maximum score updates allowed per player for the current leaderboard."
        },
        "operator": {
          "type": "integer",
          "format": "int64",
          "title": "The operator of the leaderboard"
        },
        "endActive": {
          "type": "integer",
          "format": "int64",
          "description": "The UNIX time when the leaderboard stops being active until next reset. A computed value."
        },
        "resetSchedule": {
          "type": "string",
          "description": "Reset cron expression."
        },
        "metadata": {
          "type": "string",
          "description": "Additional information stored as a JSON object."
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the leaderboard was created."
        },
        "startTime": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the leaderboard will start."
        },
        "endTime": {
          "type": "string",
          "format": "date-time",
          "description": "The UNIX time when the leaderboard will be stopped."
        },
        "duration": {
          "type": "integer",
          "format": "int64",
          "description": "Duration of the tournament in seconds."
        },
        "startActive": {
          "type": "integer",
          "format": "int64",
          "description": "The UNIX time when the leaderboard start being active. A computed value."
        },
        "joinRequired": {
          "type": "boolean",
          "description": "Join required."
        },
        "authoritative": {
          "type": "boolean",
          "description": "Authoritative."
        },
        "tournament": {
          "type": "boolean",
          "description": "Tournament."
        }
      },
      "description": "A leaderboard."
    },
    "nakamaconsoleLeaderboardList": {
      "type": "object",
      "properties": {
        "leaderboards": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/nakamaconsoleLeaderboard"
          },
          "description": "The list of leaderboards returned."
        }
      },
      "description": "A list of leaderboards."
    },
    "nakamaconsoleUpdateAccountRequest": {
      "type": "object",
      "properties": {
+1 −1
Original line number Diff line number Diff line
@@ -10,5 +10,5 @@
<link rel="stylesheet" href="static/styles.14b882f135e080634619.css"></head>
<body class="h-100">
  <app-root></app-root>
<script src="static/runtime.79a86fd8e31d575369c1.js" defer=""></script><script src="static/polyfills.e509efdf859445d7ea46.js" defer=""></script><script src="static/main.695001f2f04b0d8e5c57.js" defer=""></script></body>
<script src="static/runtime.79a86fd8e31d575369c1.js" defer=""></script><script src="static/polyfills.e509efdf859445d7ea46.js" defer=""></script><script src="static/main.d1a5b8017783afb3bf8f.js" defer=""></script></body>
</html>
Loading