Skip to content

Commit

Permalink
feat(spec): added support for /v2/characters/:id/equipmenttabs/active
Browse files Browse the repository at this point in the history
Closes #55
  • Loading branch information
TheMrMilchmann committed Apr 3, 2022
1 parent 285ba5e commit 38b6616
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 42 deletions.
1 change: 1 addition & 0 deletions api/api-generator.api
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public final class com/gw2tb/apigen/APIv2Endpoint : java/lang/Enum {
public static final field V2_CHARACTERS_CORE Lcom/gw2tb/apigen/APIv2Endpoint;
public static final field V2_CHARACTERS_CRAFTING Lcom/gw2tb/apigen/APIv2Endpoint;
public static final field V2_CHARACTERS_EQUIPMENTTABS Lcom/gw2tb/apigen/APIv2Endpoint;
public static final field V2_CHARACTERS_EQUIPMENTTABS_ACTIVE Lcom/gw2tb/apigen/APIv2Endpoint;
public static final field V2_CHARACTERS_HEROPOINTS Lcom/gw2tb/apigen/APIv2Endpoint;
public static final field V2_CHARACTERS_INVENTORY Lcom/gw2tb/apigen/APIv2Endpoint;
public static final field V2_CHARACTERS_QUESTS Lcom/gw2tb/apigen/APIv2Endpoint;
Expand Down
3 changes: 2 additions & 1 deletion docs/changelog/0.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ _Not Released Yet_

- Endpoints:
- Added support for `/v2/account/legendaryarmory`. [[GH-179](https://github.com/GW2ToolBelt/api-generator/issues/179)]
- Added support for `/v2/equipmenttabs`. [[GH-54](https://github.com/GW2ToolBelt/api-generator/issues/54)]
- Added support for `/v2/characters/:id/equipmenttabs`. [[GH-54](https://github.com/GW2ToolBelt/api-generator/issues/54)]
- Added support for `/v2/characters/:id/equipmenttabs/active`. [[GH-55](https://github.com/GW2ToolBelt/api-generator/issues/55)]
- Added support for `/v2/guild/:id/log`. [[GH-82](https://github.com/GW2ToolBelt/api-generator/issues/82)]
- Added support for `/v2/guild/:id/stash`. [[GH-85](https://github.com/GW2ToolBelt/api-generator/issues/85)]
- Added support for `/v2/legendaryarmory`. [[GH-178](https://github.com/GW2ToolBelt/api-generator/issues/178)]
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/gw2tb/apigen/APIv2Endpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public enum class APIv2Endpoint(internal val endpointName: String) {
V2_CHARACTERS_CORE("/Characters/:ID/Core"),
V2_CHARACTERS_CRAFTING("/Characters/:ID/Crafting"),
V2_CHARACTERS_EQUIPMENTTABS("/Characters/:ID/EquipmentTabs"),
V2_CHARACTERS_EQUIPMENTTABS_ACTIVE("/Characters/:ID/EquipmentTabs/Active"),
V2_CHARACTERS_HEROPOINTS("/Characters/:ID/HeroPoints"),
V2_CHARACTERS_INVENTORY("/Characters/:ID/Inventory"),
V2_CHARACTERS_QUESTS("/Characters/:ID/Quests"),
Expand Down
92 changes: 51 additions & 41 deletions src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,48 @@ internal val GW2v2 = GW2APISpecV2 {
SerialName("required_access").."RequiredAccess"(array(STRING), "the GW2 campaigns required to see the daily achievement")
}

val CHARACTERS_EQUIPMENTTAB = record(name = "CharactersEquipmentTab", description = "Information about a character's equipment tab.", endpoint = "/Characters/:ID/EquipmentTabs") {
"Tab"(INTEGER, "the tab's ID")
"Name"(STRING, "the equipment configuration's name")
SerialName("is_active").."IsActive"(BOOLEAN, "a flag indicating whether or not this tab is the active tab")
"Equipment"(
description = "the stored equipment",
type = array(record(name = "Equipment", description = "Information about a piece of equipment.") {
CamelCase("id").."ID"(INTEGER, "the equipped item's ID")
"Slot"(STRING, "the slot in which the equipment piece is slotted into")
optional.."Skin"(SKIN_ID, "the ID of the skin transmuted onto the equipment piece")
optional.."Dyes"(array(INTEGER, nullableItems = true), "the IDs of the dyes applied to the item")
optional.."Upgrades"(array(INTEGER), "the IDs of the upgrade components slotted into the item")
optional.."Infusions"(array(INTEGER), "the IDs of the infusions slotted into the item")
optional.."Binding"(STRING, "the binding of the item")
optional..SerialName("bound_to").."BoundTo"(STRING, "name of the character the item is bound to")
"Location"(STRING, "the storage location of the equipment piece")
optional.."Stats"(
description = "information about the stats chosen for the item (if the item offers the option to select stats/prefix)",
type = record(name = "Stats", description = "Information about an item's stats.") {
CamelCase("id").."ID"(INTEGER, "the itemstat ID")
optional..SerialName("Power").."Power"(INTEGER, "the amount of power given by the item")
optional..SerialName("Precision").."Precision"(INTEGER, "the amount of precision given by the item")
optional..SerialName("Toughness").."Toughness"(INTEGER, "the amount of toughness given by the item")
optional..SerialName("Vitality").."Vitality"(INTEGER, "the amount of vitality given by the item")
optional..SerialName("ConditionDamage").."ConditionDamage"(INTEGER, "the amount of condition damage given by the item")
optional..SerialName("ConditionDuration").."ConditionDuration"(INTEGER, "the amount of condition duration given by the item")
optional..SerialName("Healing").."Healing"(INTEGER, "the amount of healing given by the item")
optional..SerialName("BoonDuration").."BoonDuration"(INTEGER, "the amount of boon duration given by the item")
}
)
})
)
SerialName("equipment_pvp").."EquipmentPvP"(
description = "the character's PvP equipment",
type = record(name = "PvPEquipment", "Information about a character's PvP equipment.") {
"Amulet"(INTEGER, "the ID of the selected amulet")
"Rune"(INTEGER, "the ID of the selected rune")
"Sigils"(array(INTEGER, nullableItems = true), "the IDs of the selected sigils")
}
)
}

@APIGenDSL
fun SchemaConditionalBuilder<APIType.V2>.FACTS() {
+record(name = "AttributeAdjust", description = "Additional information about an attribute adjustment.") {
Expand Down Expand Up @@ -777,47 +819,15 @@ internal val GW2v2 = GW2APISpecV2 {
) {
pathParameter("ID", STRING, "the character's ID", camelCase = "id")

schema(record(name = "CharactersEquipmentTab", description = "Information about a character's equipment tab.") {
"Tab"(INTEGER, "the tab's ID")
"Name"(STRING, "the equipment configuration's name")
SerialName("is_active").."IsActive"(BOOLEAN, "a flag indicating whether or not this tab is the active tab")
"Equipment"(
description = "the stored equipment",
type = array(record(name = "Equipment", description = "Information about a piece of equipment.") {
CamelCase("id").."ID"(INTEGER, "the equipped item's ID")
"Slot"(STRING, "the slot in which the equipment piece is slotted into")
optional.."Skin"(SKIN_ID, "the ID of the skin transmuted onto the equipment piece")
optional.."Dyes"(array(INTEGER, nullableItems = true), "the IDs of the dyes applied to the item")
optional.."Upgrades"(array(INTEGER), "the IDs of the upgrade components slotted into the item")
optional.."Infusions"(array(INTEGER), "the IDs of the infusions slotted into the item")
optional.."Binding"(STRING, "the binding of the item")
optional..SerialName("bound_to").."BoundTo"(STRING, "name of the character the item is bound to")
"Location"(STRING, "the storage location of the equipment piece")
optional.."Stats"(
description = "information about the stats chosen for the item (if the item offers the option to select stats/prefix)",
type = record(name = "Stats", description = "Information about an item's stats.") {
CamelCase("id").."ID"(INTEGER, "the itemstat ID")
optional..SerialName("Power").."Power"(INTEGER, "the amount of power given by the item")
optional..SerialName("Precision").."Precision"(INTEGER, "the amount of precision given by the item")
optional..SerialName("Toughness").."Toughness"(INTEGER, "the amount of toughness given by the item")
optional..SerialName("Vitality").."Vitality"(INTEGER, "the amount of vitality given by the item")
optional..SerialName("ConditionDamage").."ConditionDamage"(INTEGER, "the amount of condition damage given by the item")
optional..SerialName("ConditionDuration").."ConditionDuration"(INTEGER, "the amount of condition duration given by the item")
optional..SerialName("Healing").."Healing"(INTEGER, "the amount of healing given by the item")
optional..SerialName("BoonDuration").."BoonDuration"(INTEGER, "the amount of boon duration given by the item")
}
)
})
)
SerialName("equipment_pvp").."EquipmentPvP"(
description = "the character's PvP equipment",
type = record(name = "PvPEquipment", "Information about a character's PvP equipment.") {
"Amulet"(INTEGER, "the ID of the selected amulet")
"Rune"(INTEGER, "the ID of the selected rune")
"Sigils"(array(INTEGER, nullableItems = true), "the IDs of the selected sigils")
}
)
})
schema(CHARACTERS_EQUIPMENTTAB)
}
V2_CHARACTERS_EQUIPMENTTABS_ACTIVE(
summary = "Returns information about a character's current equipment.",
security = security(ACCOUNT, BUILDS, CHARACTERS)
) {
pathParameter("ID", STRING, "the character's ID", camelCase = "id")

schema(CHARACTERS_EQUIPMENTTAB)
}
V2_CHARACTERS_HEROPOINTS(
summary = "Returns information about a character's unlock hero points.",
Expand Down
8 changes: 8 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 @@ -468,6 +468,14 @@ class GW2v2 : SpecTest<APIQuery.V2, APIType.V2, GW2v2.ExpectedAPIv2Query>(
queryDetails = QueryByPage<SchemaInteger>()
)

expectQuery(
"/Characters/:ID/EquipmentTabs/Active",
security = setOf(ACCOUNT, BUILDS, CHARACTERS),
pathParameters = listOf(
ExpectedPathParameter("ID", STRING)
)
)

expectQuery(
"/Characters/:ID/HeroPoints",
security = setOf(ACCOUNT, CHARACTERS, PROGRESSION),
Expand Down

0 comments on commit 38b6616

Please sign in to comment.