diff --git a/swat-codegen/PKGBUILD b/swat-codegen/PKGBUILD index abeb5b3..fc83441 100644 --- a/swat-codegen/PKGBUILD +++ b/swat-codegen/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Zergling_man, from fedora.email pkgname=swat-codegen -pkgver=1.1.0 +pkgver=1.1.1 pkgrel=1 pkgdesc="A simple CLI interface to RCPDv3, the rank code management service for the game SWAT: Aftermath" arch=('any') diff --git a/swat-codegen/codegen.sh b/swat-codegen/codegen.sh index 8968503..0c72a49 100755 --- a/swat-codegen/codegen.sh +++ b/swat-codegen/codegen.sh @@ -61,8 +61,9 @@ function lookup # USER-FACING COMMANDS function builds { + filter='.[] | .rankCode+" "+.buildName' if [ -n "$1" ]; then filter='.[] | select(.buildName=="'"$*"'")'; fi - get saved-builds | jq $filter + get saved-builds | jq "$filter" } function save diff --git a/swat-codegen/openapi.yaml b/swat-codegen/openapi.yaml index dcc3892..82fd8ad 100644 --- a/swat-codegen/openapi.yaml +++ b/swat-codegen/openapi.yaml @@ -3,7 +3,7 @@ info: title: SWAT Aftermath - RCPD Service description: "Rank code manager service for storing rank codes, generating rank\ \ codes, earning titles, etc. The back end for RPCD 3.0" - version: 0.25.0 + version: 0.28.0 servers: - url: https://swataftermath.com:9443/ tags: @@ -13,6 +13,8 @@ tags: description: Resource for retrieving multiple accounts. - name: Rank Code Resource description: Resource for saving and retrieving rank codes and builds. +- name: Statistics Resource + description: Resource for retrieving various statistics about your account - name: Unlocks Resource description: Resource for retrieving the maximum rank unlocked for each SWAT build element. @@ -260,6 +262,125 @@ paths: $ref: "#/components/schemas/ErrorResponse" security: - SWAT-Token: [] + /account/join-honor-guard: + post: + tags: + - Account Resource + summary: Make default account join honor guard. + description: "Make the default RCPD account for this user join the honor guard.\ + \ This will reset all RCPD unlock progress and delete all saved builds, but\ + \ will allow you to earn medals and titles on unique hero combinations (class,\ + \ trait, specialization), and earn account-level titles." + operationId: joinHonorGuard + responses: + "500": + description: Something went wrong when processing the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: A dependent service or database had an error. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "204": + description: Default account successfully joined the honor guard. + "400": + description: Default account is already an honor guard account. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "401": + description: "Authorization header is not present, or token is invalid or\ + \ expired." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + description: The security infrastructure cannot currently handle the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: The requested resource could not be found. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + security: + - SWAT-Token: [] + /account/{username}/join-honor-guard: + post: + tags: + - Account Resource + summary: Make account join honor guard. + description: "Make the specified RCPD account for this user join the honor guard.\ + \ This will reset all RCPD unlock progress and delete all saved builds, but\ + \ will allow you to earn medals and titles on unique hero combinations (class,\ + \ trait, specialization), and earn account-level titles." + operationId: joinHonorGuard_1 + parameters: + - name: username + in: path + description: The username of the RCPD account that should join the honor guard. + The username is case sensitive. + required: true + schema: + type: string + example: teller55 + responses: + "500": + description: Something went wrong when processing the request. + content: + '*/*': + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: A dependent service or database had an error. + content: + '*/*': + schema: + $ref: "#/components/schemas/ErrorResponse" + "204": + description: Account successfully joined the honor guard. + "400": + description: Account is already an honor guard account. + content: + '*/*': + schema: + $ref: "#/components/schemas/ErrorResponse" + "401": + description: "Authorization header is not present, or token is invalid or\ + \ expired." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + description: The security infrastructure cannot currently handle the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "403": + description: You are not allowed to perform the requested action. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: The requested resource could not be found. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + security: + - SWAT-Token: [] /account/{username}/set-default: post: tags: @@ -378,7 +499,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/AccountSummaryResponse" + $ref: "#/components/schemas/AccountResponse" "401": description: "Authorization header is not present, or token is invalid or\ \ expired." @@ -429,7 +550,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/AccountSummaryResponse" + $ref: "#/components/schemas/AccountResponse" /accounts/search: get: tags: @@ -468,7 +589,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/AccountSummaryResponse" + $ref: "#/components/schemas/AccountResponse" "400": description: Username to search for was not provided. Includes if the provided query param is blank. @@ -642,6 +763,13 @@ paths: application/json: schema: $ref: "#/components/schemas/HeroBuildResponse" + "400": + description: One or more of the requested build parts has not been unlocked + to at least rank 1. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" "401": description: "Authorization header is not present, or token is invalid or\ \ expired." @@ -705,6 +833,13 @@ paths: application/json: schema: $ref: "#/components/schemas/HeroBuildResponse" + "400": + description: One or more of the requested build parts has not been unlocked + to at least rank 1. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" "401": description: "Authorization header is not present, or token is invalid or\ \ expired." @@ -1042,6 +1177,117 @@ paths: $ref: "#/components/schemas/ErrorResponse" security: - SWAT-Token: [] + /account/medals-and-titles: + get: + tags: + - Statistics Resource + description: Get the total number of medals and titles you have earned on your + unique combinations for your default RCPD account. + operationId: getDefaultStatistics + responses: + "500": + description: Something went wrong when processing the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: A dependent service or database had an error. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "200": + description: The total number of medals and titles earned for your default + RCPD account. + content: + application/json: + schema: + $ref: "#/components/schemas/Account Statistics Response" + "401": + description: "Authorization header is not present, or token is invalid or\ + \ expired." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + description: The security infrastructure cannot currently handle the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: The requested resource could not be found. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + security: + - SWAT-Token: [] + /account/{username}/medals-and-titles: + get: + tags: + - Statistics Resource + description: Get the total number of medals and titles you have earned on your + unique combinations for your specified RCPD account. + operationId: getStatistics + parameters: + - name: username + in: path + description: The username of the RCPD account you wish to retrieve the medals + and titles for. The username is case sensitive. + required: true + schema: + type: string + example: teller55 + responses: + "500": + description: Something went wrong when processing the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "502": + description: A dependent service or database had an error. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "200": + description: The total number of medals and titles earned for your specified + RCPD account. + content: + application/json: + schema: + $ref: "#/components/schemas/Account Statistics Response" + "401": + description: "Authorization header is not present, or token is invalid or\ + \ expired." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "503": + description: The security infrastructure cannot currently handle the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "403": + description: You are not allowed to perform the requested action. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: The requested resource could not be found. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + security: + - SWAT-Token: [] /account/unlocks: get: tags: @@ -1214,6 +1460,15 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" + /openapi: + get: + tags: + - Open API Resource + description: Default endpoint to redirect to index.html page. + operationId: getIndex + responses: + "303": + description: Redirect to index page. components: schemas: ErrorResponse: @@ -1274,7 +1529,8 @@ components: example: 1 points: type: integer - description: The amount of points this account has earned through titles. + description: The amount of points this account has earned through medals + and titles. format: int64 example: 100 leaderboardRanking: @@ -1296,16 +1552,16 @@ components: description: "Whether this account has used a code generator to save generated\ \ rank codes, rather than earning codes solely through playing SWAT: Aftermath." example: false + active: + type: boolean + description: Whether this account has been logged into or done anything + recently. lastActive: type: integer description: "The last time this account was active (logged in to, saved\ \ a build, generated a build, etc.) represented as milliseconds from epoch." format: int64 example: 1695474479000 - active: - type: boolean - description: Whether this account has been logged into or done anything - recently. description: A response containing information about an RCPD account. AccountTitlesResponse: title: Account Titles Response @@ -1556,57 +1812,6 @@ components: description: "A request to update various things on an account. All parameters\ \ are optional. To delete a value, provide an empty string. This will delete\ \ the value in the database." - AccountSummaryResponse: - type: object - properties: - username: - type: string - description: The username of this RCPD account. - example: Teller55 - icon: - type: integer - description: An integer representing the icon (display picture) for the - account. - format: int32 - example: 0 - description: - type: string - description: A public message for the account that will be displayed on - the leaderboard and to people viewing the account. - nullable: true - example: Swat season 2 lets go! - squad: - type: string - description: The group/clan this account belongs to. - nullable: true - example: XLR8 - rank: - maximum: 11 - minimum: 1 - type: integer - description: The account rank as an integer. - format: int32 - example: 1 - corrupt: - type: boolean - description: "Whether this account has used a code generator to save generated\ - \ rank codes, rather than earning codes solely through playing SWAT: Aftermath." - example: false - active: - type: boolean - description: Whether this account has been logged into or done anything - recently. - lastActive: - type: integer - description: "The last time this account was active (logged in to, saved\ - \ a build, generated a build, etc.) represented as milliseconds from epoch." - format: int64 - example: 1695474479000 - honorGuard: - type: boolean - description: Whether this account has joined the honor guard. - example: true - description: An RCPD account summary. HeroBuildResponse: title: Hero Build Response type: object @@ -1917,6 +2122,51 @@ components: description: An optional name for this build. example: Solo HO description: A rank code and optional build name to save. + Account Statistics Response: + type: object + properties: + totalKeys: + type: integer + format: int32 + totalMohs: + type: integer + format: int32 + totalPccs: + type: integer + format: int32 + totalCobs: + type: integer + format: int32 + totalLsas: + type: integer + format: int32 + totalRem1s: + type: integer + format: int32 + totalRem2s: + type: integer + format: int32 + totalRem3s: + type: integer + format: int32 + totalNightmares: + type: integer + format: int32 + totalExtinctions: + type: integer + format: int32 + totalMegazillas: + type: integer + format: int32 + totalDeathless: + type: integer + format: int32 + totalImpressives: + type: integer + format: int32 + totalSolos: + type: integer + format: int32 UnlocksResponse: title: Unlocks Response type: object