Skip to content

Commit

Permalink
feat(spec): add /v2/achievements
Browse files Browse the repository at this point in the history
Closes #35
  • Loading branch information
TheMrMilchmann committed Jan 16, 2021
1 parent 1b6b979 commit 41769dc
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changelog/0.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ _Not Released Yet_
#### Improvements

- Endpoints:
- Added support for `/v2/achievements`. [[GH-35](https://github.com/GW2ToolBelt/api-generator/issues/35)]
- Added support for `/v2/finishers`. [[GH-79](https://github.com/GW2ToolBelt/api-generator/issues/79)]
- Added support for `/v2/guild/upgrades`. [[GH-92](https://github.com/GW2ToolBelt/api-generator/issues/92)]
- Added support for `/v2/minis`. [[GH-104](https://github.com/GW2ToolBelt/api-generator/issues/104)]
Expand Down
53 changes: 53 additions & 0 deletions src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,59 @@ internal val GW2v2 = GW2APIVersion {

schema(array(STRING, "an array of IDs for each world boss that can be looted once per day that the player has defeated since the most recent daily reset"))
}
"/Achievements" {
summary = "Returns information about achievements."
cache = 1.hours
isLocalized = true

supportedQueries(BY_ID, BY_IDS(all = false), BY_PAGE)
schema(record(name = "Achievement", description = "Information about an achievement.") {
CamelCase("id").."ID"(INTEGER, "the achievement's ID")
"Icon"(STRING, "the URL for the achievement's icon")
"Name"(STRING, "the achievement's name")
"Description"(STRING, "the achievement's description")
"Requirement"(STRING, "the achievement's requirement as listed in-game")
SerialName("locked_text").."LockedText"(STRING, "the achievement's in-game description prior to unlocking it")
"Type"(STRING, "the achievement's type")
"Flags"(array(STRING), "the achievement's categories")
"Tiers"(
description = "the achievement's tiers",
type = array(record(name = "Tier", description = "Information about an achievement's tier.") {
"Count"(INTEGER, "the number of \"things\" (achievement-specific) that must be completed to achieve this tier")
"Points"(INTEGER, "the amount of AP awarded for completing this tier")
})
)
optional.."Prerequisites"(array(INTEGER), "the IDs of the achievements that are required to progress this achievement")
optional.."Rewards"(
description = "the achievement's rewards",
type = array(conditional(name = "Reward", description = "Information about an achievement reward.") {
"Coins"(record("Information about a coin reward.") {
"Count"(INTEGER, "the amount of coins")
})
"Items"(record("Information about an item reward.") {
CamelCase("id").."ID"(INTEGER, "the item's ID")
"Count"(INTEGER, "the amount of the item")
})
"Mastery"(record("Information about a mastery point reward.") {
CamelCase("id").."ID"(INTEGER, "the mastery point's ID")
"Region"(STRING, "the mastery point's region")
})
"Title"(record("Information about a title reward") {
CamelCase("id").."ID"(INTEGER, "the title's ID")
})
})
)
optional.."Bits"(
description = "the achievement's bits",
type = array(record(name = "Bit", description = "Information about an achievement bit.") {
"Type"(STRING, "the bit's type")
optional..CamelCase("id").."ID"(INTEGER, "the ID of the bit's object")
optional.."Text"(STRING, "the bit's text")
})
)
optional..SerialName("point_cap").."PointCap"(INTEGER, "the maximum number of AP that can be rewarded by an achievement flagged as \"Repeatable\"")
})
}
"/Build" {
summary = "Returns the current build ID."

Expand Down
5 changes: 5 additions & 0 deletions src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ class GW2v2 : SpecTest(
expectEndpoint("/Account/WorldBosses")
.security(ACCOUNT, PROGRESSION)

expectEndpoint("/Achievements")
.cacheTime(1.hours)
.localized()
.queryTypes(BY_ID, BY_IDS(all = false), BY_PAGE)

expectEndpoint("/Build")

expectEndpoint("/Characters/:ID/Inventory")
Expand Down

0 comments on commit 41769dc

Please sign in to comment.