Commit 538d2d85 authored by Chris Molozian's avatar Chris Molozian
Browse files

Small improvements to code generation for the console API.

parent dbc500e7
Loading
Loading
Loading
Loading
+32 −67
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
 */
service Console {
  // Authenticate a console user with username and password.
  rpc Authenticate (AuthenticateRequest) returns (Session) {
  rpc Authenticate (AuthenticateRequest) returns (ConsoleSession) {
    option (google.api.http) = {
      post: "/v2/console/authenticate",
      body: "*"
@@ -221,9 +221,7 @@ service Console {
  }
}

/**
 * Deletion request for a user account.
 */
// Delete a user account.
message AccountDeleteRequest {
  // The unique identifier of the user account.
  string id = 1;
@@ -231,9 +229,7 @@ message AccountDeleteRequest {
  google.protobuf.BoolValue record_deletion = 2;
}

/**
 * An export of all information stored for a user account.
 */
// An export of all information stored for a user account.
message AccountExport {
  // The user's account details.
  nakama.api.Account account = 1;
@@ -253,17 +249,13 @@ message AccountExport {
  repeated WalletLedger wallet_ledgers = 8;
}

/**
 * The identifier for a user account.
 */
// The identifier for a user account.
message AccountId {
  // The unique identifier of the user account.
  string id = 1;
}

/**
 * Authenticate a console user with username and password.
 */
// Authenticate a console user with username and password.
message AuthenticateRequest {
  // The username of the user.
  string username = 1;
@@ -271,10 +263,9 @@ message AuthenticateRequest {
  string password = 2;
}

/**
 * Configuration and config warnings information.
 */
// The current server configuration and any associated warnings.
message Config {
  // A warning for a configuration field.
  message Warning {
    // The config field this warning is for in a JSON pointer format.
    string field = 1;
@@ -282,15 +273,19 @@ message Config {
    string message = 2;
  }

  // JSON-encoded effective server configuration.
  // JSON-encoded active server configuration.
  string config = 1;
  // Any warnings about the current config.
  repeated Warning warnings = 2;
}

/**
 * Delete friend relationship between two users.
 */
// A console user session.
message ConsoleSession {
  // A session token (JWT) for the console user.
  string token = 1;
}

// Delete friend relationship between two users.
message DeleteFriendRequest {
  // The user do delete for.
  string id = 1;
@@ -298,9 +293,7 @@ message DeleteFriendRequest {
  string friend_id = 2;
}

/**
 * Remove a user from a group.
 */
// Remove a user from a group.
message DeleteGroupUserRequest {
  // User to remove.
  string id = 1;
@@ -308,9 +301,7 @@ message DeleteGroupUserRequest {
  string group_id = 2;
}

/**
 * Delete an individual storage object.
 */
// Delete an individual storage object.
message DeleteStorageObjectRequest {
  // Collection.
  string collection = 1;
@@ -322,9 +313,7 @@ message DeleteStorageObjectRequest {
  string version = 4;
}

/**
 * Delete a single wallet ledger item.
 */
// Delete a single wallet ledger item.
message DeleteWalletLedgerRequest {
  // User ID to remove wallet ledger item from.
  string id = 1;
@@ -332,17 +321,13 @@ message DeleteWalletLedgerRequest {
  string wallet_id = 2;
}

/**
 * List (and optionally filter) storage data.
 */
// List (and optionally filter) storage objects.
message ListStorageRequest {
  // User ID to filter data for.
  // User ID to filter objects for.
  string user_id = 1;
}

/**
 * List (and optionally filter) users.
 */
// List (and optionally filter) users.
message ListUsersRequest {
  // User ID or username filter.
  string filter = 1;
@@ -350,20 +335,19 @@ message ListUsersRequest {
  bool banned = 2;
  // Search only recorded deletes.
  bool tombstones = 3;
  // Optional cursor to fetch next page.
  // An (optional) cursor to fetch next page.
  bytes cursor = 4;
}

// List of storage objects.
message StorageList {
  // List of storage objects matching list/filter operation.
  repeated nakama.api.StorageObject objects = 1;
  // Optional cursor for pagination.
  // An (optional) cursor for paging results.
  bytes cursor = 2;
}

/**
 * Unlink a particular device ID from a user's account.
 */
// Unlink a particular device ID from a user's account.
message UnlinkDeviceRequest {
  // User ID to unlink from.
  string id = 1;
@@ -371,9 +355,7 @@ message UnlinkDeviceRequest {
  string device_id = 2;
}

/**
 * Update user account information.
 */
// Update user account information.
message UpdateAccountRequest {
  // User ID to update.
  string id = 1;
@@ -401,9 +383,7 @@ message UpdateAccountRequest {
  google.protobuf.StringValue wallet = 12;
}

/**
 * A list of users.
 */
// A list of users.
message UserList {
  // A list of users.
  repeated nakama.api.User users = 1;
@@ -411,18 +391,9 @@ message UserList {
  bytes cursor = 2;
}

/**
 * A console user session.
 */
message Session {
  // Session token.
  string token = 1;
}

/**
 * List of nodes and their stats.
 */
// List of nodes and their stats.
message StatusList {
  // The status of a Nakama node.
  message Status {
    // Node name.
    string name = 1;
@@ -464,9 +435,7 @@ message StatusList {
  repeated Status nodes = 1;
}

/**
 * An individual update to a user's wallet.
 */
// An individual update to a user's wallet.
message WalletLedger {
  // The identifier of this wallet change.
  string id = 1;
@@ -482,17 +451,13 @@ message WalletLedger {
  google.protobuf.Timestamp update_time = 6;
}

/**
 * List of wallet ledger items for a particular user.
 */
// List of wallet ledger items for a particular user.
message WalletLedgerList {
  // A list of wallet ledger items.
  repeated WalletLedger items = 1;
}

/**
 * Write a new storage object or update an existing one.
 */
// Write a new storage object or update an existing one.
message WriteStorageObjectRequest {
  // Collection.
  string collection = 1;
+76 −78
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
        "operationId": "GetAccount",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/apiAccount"
            }
@@ -50,9 +50,9 @@
        "operationId": "DeleteAccount",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -82,9 +82,9 @@
        "operationId": "UpdateAccount",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -108,9 +108,9 @@
        "operationId": "BanUser",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -134,7 +134,7 @@
        "operationId": "ExportAccount",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleAccountExport"
            }
@@ -160,7 +160,7 @@
        "operationId": "GetFriends",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/apiFriends"
            }
@@ -186,9 +186,9 @@
        "operationId": "DeleteFriend",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -219,7 +219,7 @@
        "operationId": "GetGroups",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/apiUserGroupList"
            }
@@ -245,9 +245,9 @@
        "operationId": "DeleteGroupUser",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -278,9 +278,9 @@
        "operationId": "UnbanUser",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -304,9 +304,9 @@
        "operationId": "UnlinkCustom",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -330,9 +330,9 @@
        "operationId": "UnlinkDevice",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -356,9 +356,9 @@
        "operationId": "UnlinkEmail",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -382,9 +382,9 @@
        "operationId": "UnlinkFacebook",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -408,9 +408,9 @@
        "operationId": "UnlinkGameCenter",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -434,9 +434,9 @@
        "operationId": "UnlinkGoogle",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -460,9 +460,9 @@
        "operationId": "UnlinkSteam",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -486,7 +486,7 @@
        "operationId": "GetWalletLedger",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleWalletLedgerList"
            }
@@ -512,9 +512,9 @@
        "operationId": "DeleteWalletLedger",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -545,9 +545,9 @@
        "operationId": "Authenticate",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nakamaconsoleSession"
              "$ref": "#/definitions/consoleConsoleSession"
            }
          }
        },
@@ -577,7 +577,7 @@
        "operationId": "GetConfig",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleConfig"
            }
@@ -594,7 +594,7 @@
        "operationId": "GetStatus",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleStatusList"
            }
@@ -611,7 +611,7 @@
        "operationId": "ListStorage",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleStorageList"
            }
@@ -620,7 +620,7 @@
        "parameters": [
          {
            "name": "user_id",
            "description": "User ID to filter data for.",
            "description": "User ID to filter objects for.",
            "in": "query",
            "required": false,
            "type": "string"
@@ -635,9 +635,9 @@
        "operationId": "DeleteStorage",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -652,9 +652,9 @@
        "operationId": "DeleteStorageObject",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -697,9 +697,9 @@
        "operationId": "WriteStorageObject",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -737,9 +737,9 @@
        "operationId": "DeleteStorageObject2",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -784,7 +784,7 @@
        "operationId": "ListUsers",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/consoleUserList"
            }
@@ -816,7 +816,7 @@
          },
          {
            "name": "cursor",
            "description": "Optional cursor to fetch next page.",
            "description": "An (optional) cursor to fetch next page.",
            "in": "query",
            "required": false,
            "type": "string",
@@ -832,9 +832,9 @@
        "operationId": "DeleteUsers",
        "responses": {
          "200": {
            "description": "",
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
              "properties": {}
            }
          }
        },
@@ -856,7 +856,8 @@
          "type": "string",
          "description": "Warning message text."
        }
      }
      },
      "description": "A warning for a configuration field."
    },
    "StatusListStatus": {
      "type": "object",
@@ -945,7 +946,8 @@
          "format": "double",
          "description": "Output bandwidth usage over the last hour."
        }
      }
      },
      "description": "The status of a Nakama node."
    },
    "UserGroupListUserGroup": {
      "type": "object",
@@ -1428,7 +1430,7 @@
          "description": "The user's wallet ledger items."
        }
      },
      "description": "*\nAn export of all information stored for a user account."
      "description": "An export of all information stored for a user account."
    },
    "consoleAuthenticateRequest": {
      "type": "object",
@@ -1442,14 +1444,14 @@
          "description": "The password of the user."
        }
      },
      "description": "*\nAuthenticate a console user with username and password."
      "description": "Authenticate a console user with username and password."
    },
    "consoleConfig": {
      "type": "object",
      "properties": {
        "config": {
          "type": "string",
          "description": "JSON-encoded effective server configuration."
          "description": "JSON-encoded active server configuration."
        },
        "warnings": {
          "type": "array",
@@ -1459,7 +1461,17 @@
          "description": "Any warnings about the current config."
        }
      },
      "description": "*\nConfiguration and config warnings information."
      "description": "The current server configuration and any associated warnings."
    },
    "consoleConsoleSession": {
      "type": "object",
      "properties": {
        "token": {
          "type": "string",
          "description": "A session token (JWT) for the console user."
        }
      },
      "description": "A console user session."
    },
    "consoleStatusList": {
      "type": "object",
@@ -1472,7 +1484,7 @@
          "description": "List of nodes and their stats."
        }
      },
      "description": "*\nList of nodes and their stats."
      "description": "List of nodes and their stats."
    },
    "consoleStorageList": {
      "type": "object",
@@ -1487,10 +1499,11 @@
        "cursor": {
          "type": "string",
          "format": "byte",
          "description": "Optional cursor for pagination."
        }
          "description": "An (optional) cursor for paging results."
        }
      },
      "description": "List of storage objects."
    },
    "consoleUserList": {
      "type": "object",
      "properties": {
@@ -1507,7 +1520,7 @@
          "description": "A cursor to fetch more results."
        }
      },
      "description": "*\nA list of users."
      "description": "A list of users."
    },
    "consoleWalletLedger": {
      "type": "object",
@@ -1539,7 +1552,7 @@
          "description": "The UNIX time when the wallet ledger item was updated."
        }
      },
      "description": "*\nAn individual update to a user's wallet."
      "description": "An individual update to a user's wallet."
    },
    "consoleWalletLedgerList": {
      "type": "object",
@@ -1552,22 +1565,7 @@
          "description": "A list of wallet ledger items."
        }
      },
      "description": "*\nList of wallet ledger items for a particular user."
    },
    "nakamaconsoleSession": {
      "type": "object",
      "properties": {
        "token": {
          "type": "string",
          "description": "Session token."
        }
      },
      "description": "*\nA console user session."
    },
    "protobufEmpty": {
      "type": "object",
      "description": "service Foo {\n      rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n    }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.",
      "title": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:"
      "description": "List of wallet ledger items for a particular user."
    }
  },
  "securityDefinitions": {
+37 −50

File changed.

Preview size limit exceeded, changes collapsed.