From bfeca0c780c3c0ca5bdf4d8d9d1e07f450237aa0 Mon Sep 17 00:00:00 2001 From: Leon Linhart Date: Thu, 8 Apr 2021 15:47:04 +0200 Subject: [PATCH] feat(spec): add /v2/characters/:id/skills Closes #61 --- docs/changelog/0.4.0.md | 1 + .../com/gw2tb/apigen/internal/spec/GW2v2.kt | 23 ++++++++++++++ .../apigen/v2_characters_{id}_skills.json | 31 +++++++++++++++++++ .../com/gw2tb/apigen/test/spec/GW2v2.kt | 8 +++++ 4 files changed, 63 insertions(+) create mode 100644 src/main/resources/com/gw2tb/apigen/v2_characters_{id}_skills.json diff --git a/docs/changelog/0.4.0.md b/docs/changelog/0.4.0.md index 7aa9c1ef..5b1f7ae4 100644 --- a/docs/changelog/0.4.0.md +++ b/docs/changelog/0.4.0.md @@ -18,6 +18,7 @@ _Not Released Yet_ - Added support for `/v2/characters/:id/quests`. [[GH-58](https://github.com/GW2ToolBelt/api-generator/issues/58)] - Added support for `/v2/characters/:id/recipes`. [[GH-59](https://github.com/GW2ToolBelt/api-generator/issues/59)] - Added support for `/v2/characters/:id/sab`. [[GH-60](https://github.com/GW2ToolBelt/api-generator/issues/60)] + - Added support for `/v2/characters/:id/skills`. [[GH-61](https://github.com/GW2ToolBelt/api-generator/issues/61)] - Added support for `/v2/characters/:id/specializations`. [[GH-62](https://github.com/GW2ToolBelt/api-generator/issues/62)] - Added support for `/v2/characters/:id/training`. [[GH-63](https://github.com/GW2ToolBelt/api-generator/issues/63)] - Added support for `/v2/guild/search`. [[GH-91](https://github.com/GW2ToolBelt/api-generator/issues/91)] diff --git a/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt b/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt index b85f6d2f..2d1ed4b9 100644 --- a/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt +++ b/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt @@ -727,6 +727,29 @@ internal val GW2v2 = GW2APIVersion({ APIVersionBuilder.V2() }) { ) }) } + "/Characters/:ID/Skills"(until = V2_SCHEMA_2019_12_19T00_00_00_000Z) { + summary = "Returns information about a character's equipped skills." + security = setOf(ACCOUNT, BUILDS, CHARACTERS) + + pathParameter("ID", STRING, "the character's ID", camelCase = "id") + schema(record(name = "CharactersSkills", description = "Information about a character's equipped skills.") { + "Skills"( + description = "the character's equipped skills", + type = record(name = "Skills", description = "Information about a character's equipped skills.") { + val SKILLS = record(name = "Skills", description = "Information about a character's equipped skills.") { + optional.."Heal"(INTEGER, "the heal skill's ID") + "Utilities"(array(INTEGER, nullableItems = true), "the IDs of the utility skills") + optional.."Elite"(INTEGER, "the elite skill's ID") + optional.."Legends"(array(STRING, nullableItems = true), "the legend IDs") + } + + CamelCase("pve").."PvE"(SKILLS, "the character's PvE skills") + CamelCase("pvp").."PvP"(SKILLS, "the character's PvP skills") + CamelCase("wvw").."WvW"(SKILLS, "the character's WvW skills") + } + ) + }) + } "/Characters/:ID/Specializations"(until = V2_SCHEMA_2019_12_19T00_00_00_000Z) { summary = "Returns information about a character's equipped specializations." security = setOf(ACCOUNT, BUILDS, CHARACTERS) diff --git a/src/main/resources/com/gw2tb/apigen/v2_characters_{id}_skills.json b/src/main/resources/com/gw2tb/apigen/v2_characters_{id}_skills.json new file mode 100644 index 00000000..32b03eaa --- /dev/null +++ b/src/main/resources/com/gw2tb/apigen/v2_characters_{id}_skills.json @@ -0,0 +1,31 @@ +{ + "skills": { + "pve": { + "heal": 30305, + "utilities": [ + 10200, + 10236, + 10197 + ], + "elite": 29519 + }, + "pvp": { + "heal": 30305, + "utilities": [ + 10200, + 10236, + 10197 + ], + "elite": 29519 + }, + "wvw": { + "heal": 30305, + "utilities": [ + 10200, + 10236, + 10197 + ], + "elite": 29519 + } + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v2.kt b/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v2.kt index 7aa45d06..ce145e75 100644 --- a/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v2.kt +++ b/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v2.kt @@ -426,6 +426,14 @@ class GW2v2 : SpecTest( ) ) + expectQuery( + "/Characters/:ID/Skills", + security = setOf(ACCOUNT, BUILDS, CHARACTERS), + pathParameters = listOf( + ExpectedPathParameter("ID", STRING) + ) + ) + expectQuery( "/Characters/:ID/Specializations", security = setOf(ACCOUNT, BUILDS, CHARACTERS),