Saved build filter actually works now, also display only code+name by default

This commit is contained in:
Zergling_man 2025-06-01 17:07:01 +10:00
parent 0126ec1204
commit bc68c03f34
3 changed files with 313 additions and 62 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Zergling_man, from fedora.email # Maintainer: Zergling_man, from fedora.email
pkgname=swat-codegen pkgname=swat-codegen
pkgver=1.1.0 pkgver=1.1.1
pkgrel=1 pkgrel=1
pkgdesc="A simple CLI interface to RCPDv3, the rank code management service for the game SWAT: Aftermath" pkgdesc="A simple CLI interface to RCPDv3, the rank code management service for the game SWAT: Aftermath"
arch=('any') arch=('any')

View File

@ -61,8 +61,9 @@ function lookup
# USER-FACING COMMANDS # USER-FACING COMMANDS
function builds function builds
{ {
filter='.[] | .rankCode+" "+.buildName'
if [ -n "$1" ]; then filter='.[] | select(.buildName=="'"$*"'")'; fi if [ -n "$1" ]; then filter='.[] | select(.buildName=="'"$*"'")'; fi
get saved-builds | jq $filter get saved-builds | jq "$filter"
} }
function save function save

View File

@ -3,7 +3,7 @@ info:
title: SWAT Aftermath - RCPD Service title: SWAT Aftermath - RCPD Service
description: "Rank code manager service for storing rank codes, generating rank\ description: "Rank code manager service for storing rank codes, generating rank\
\ codes, earning titles, etc. The back end for RPCD 3.0" \ codes, earning titles, etc. The back end for RPCD 3.0"
version: 0.25.0 version: 0.28.0
servers: servers:
- url: https://swataftermath.com:9443/ - url: https://swataftermath.com:9443/
tags: tags:
@ -13,6 +13,8 @@ tags:
description: Resource for retrieving multiple accounts. description: Resource for retrieving multiple accounts.
- name: Rank Code Resource - name: Rank Code Resource
description: Resource for saving and retrieving rank codes and builds. 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 - name: Unlocks Resource
description: Resource for retrieving the maximum rank unlocked for each SWAT build description: Resource for retrieving the maximum rank unlocked for each SWAT build
element. element.
@ -260,6 +262,125 @@ paths:
$ref: "#/components/schemas/ErrorResponse" $ref: "#/components/schemas/ErrorResponse"
security: security:
- SWAT-Token: [] - 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: /account/{username}/set-default:
post: post:
tags: tags:
@ -378,7 +499,7 @@ paths:
schema: schema:
type: array type: array
items: items:
$ref: "#/components/schemas/AccountSummaryResponse" $ref: "#/components/schemas/AccountResponse"
"401": "401":
description: "Authorization header is not present, or token is invalid or\ description: "Authorization header is not present, or token is invalid or\
\ expired." \ expired."
@ -429,7 +550,7 @@ paths:
schema: schema:
type: array type: array
items: items:
$ref: "#/components/schemas/AccountSummaryResponse" $ref: "#/components/schemas/AccountResponse"
/accounts/search: /accounts/search:
get: get:
tags: tags:
@ -468,7 +589,7 @@ paths:
schema: schema:
type: array type: array
items: items:
$ref: "#/components/schemas/AccountSummaryResponse" $ref: "#/components/schemas/AccountResponse"
"400": "400":
description: Username to search for was not provided. Includes if the provided description: Username to search for was not provided. Includes if the provided
query param is blank. query param is blank.
@ -642,6 +763,13 @@ paths:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/HeroBuildResponse" $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": "401":
description: "Authorization header is not present, or token is invalid or\ description: "Authorization header is not present, or token is invalid or\
\ expired." \ expired."
@ -705,6 +833,13 @@ paths:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/HeroBuildResponse" $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": "401":
description: "Authorization header is not present, or token is invalid or\ description: "Authorization header is not present, or token is invalid or\
\ expired." \ expired."
@ -1042,6 +1177,117 @@ paths:
$ref: "#/components/schemas/ErrorResponse" $ref: "#/components/schemas/ErrorResponse"
security: security:
- SWAT-Token: [] - 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: /account/unlocks:
get: get:
tags: tags:
@ -1214,6 +1460,15 @@ paths:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/ErrorResponse" $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: components:
schemas: schemas:
ErrorResponse: ErrorResponse:
@ -1274,7 +1529,8 @@ components:
example: 1 example: 1
points: points:
type: integer 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 format: int64
example: 100 example: 100
leaderboardRanking: leaderboardRanking:
@ -1296,16 +1552,16 @@ components:
description: "Whether this account has used a code generator to save generated\ description: "Whether this account has used a code generator to save generated\
\ rank codes, rather than earning codes solely through playing SWAT: Aftermath." \ rank codes, rather than earning codes solely through playing SWAT: Aftermath."
example: false example: false
active:
type: boolean
description: Whether this account has been logged into or done anything
recently.
lastActive: lastActive:
type: integer type: integer
description: "The last time this account was active (logged in to, saved\ description: "The last time this account was active (logged in to, saved\
\ a build, generated a build, etc.) represented as milliseconds from epoch." \ a build, generated a build, etc.) represented as milliseconds from epoch."
format: int64 format: int64
example: 1695474479000 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. description: A response containing information about an RCPD account.
AccountTitlesResponse: AccountTitlesResponse:
title: Account Titles Response title: Account Titles Response
@ -1556,57 +1812,6 @@ components:
description: "A request to update various things on an account. All parameters\ 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\ \ are optional. To delete a value, provide an empty string. This will delete\
\ the value in the database." \ 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: HeroBuildResponse:
title: Hero Build Response title: Hero Build Response
type: object type: object
@ -1917,6 +2122,51 @@ components:
description: An optional name for this build. description: An optional name for this build.
example: Solo HO example: Solo HO
description: A rank code and optional build name to save. 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: UnlocksResponse:
title: Unlocks Response title: Unlocks Response
type: object type: object