diff --git a/api/api-generator.api b/api/api-generator.api index 2e1d9d59..e3ad635d 100644 --- a/api/api-generator.api +++ b/api/api-generator.api @@ -92,6 +92,7 @@ public final class com/gw2tb/apigen/APIv2Endpoint : java/lang/Enum { public static final field V2_CHARACTERS_BUILDTABS Lcom/gw2tb/apigen/APIv2Endpoint; 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_EQUIPMENT 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; diff --git a/docs/changelog/0.5.0.md b/docs/changelog/0.5.0.md index 5cef053f..3d6826c4 100644 --- a/docs/changelog/0.5.0.md +++ b/docs/changelog/0.5.0.md @@ -6,6 +6,7 @@ _Not Released Yet_ - Endpoints: - Added support for `/v2/account/legendaryarmory`. [[GH-179](https://github.com/GW2ToolBelt/api-generator/issues/179)] + - Added support for `/v2/characters/:id/equipment`. [[GH-53](https://github.com/GW2ToolBelt/api-generator/issues/53)] - 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)] diff --git a/src/main/kotlin/com/gw2tb/apigen/APIv2Endpoint.kt b/src/main/kotlin/com/gw2tb/apigen/APIv2Endpoint.kt index d03273e7..fbd8140b 100644 --- a/src/main/kotlin/com/gw2tb/apigen/APIv2Endpoint.kt +++ b/src/main/kotlin/com/gw2tb/apigen/APIv2Endpoint.kt @@ -69,6 +69,7 @@ public enum class APIv2Endpoint(internal val endpointName: String) { V2_CHARACTERS_BUILDTABS("/Characters/:ID/BuildTabs"), V2_CHARACTERS_CORE("/Characters/:ID/Core"), V2_CHARACTERS_CRAFTING("/Characters/:ID/Crafting"), + V2_CHARACTERS_EQUIPMENT("/Characters/:ID/Equipment"), V2_CHARACTERS_EQUIPMENTTABS("/Characters/:ID/EquipmentTabs"), V2_CHARACTERS_EQUIPMENTTABS_ACTIVE("/Characters/:ID/EquipmentTabs/Active"), V2_CHARACTERS_HEROPOINTS("/Characters/:ID/HeroPoints"), 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 a086eae3..22138cc7 100644 --- a/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt +++ b/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v2.kt @@ -806,6 +806,52 @@ internal val GW2v2 = GW2APISpecV2 { ) }) } + V2_CHARACTERS_EQUIPMENT( + summary = "Returns information about a character's equipment.", + security = security(ACCOUNT, BUILDS, CHARACTERS) + ) { + pathParameter("ID", STRING, "the character's ID", camelCase = "id") + + schema(record(name = "CharactersEquipment", description = "Information about a character's equipment.") { + "Equipment"( + description = "the character's equipment", + type = array(record(name = "EquipmentSlot", description = "Information a character's equipment slot.") { + CamelCase("id").."ID"(INTEGER, "the equipment piece's item ID") + until(V2_SCHEMA_2019_12_19T00_00_00_000Z).."Slot"(STRING, "the equipment piece's slot") + since(V2_SCHEMA_2019_12_19T00_00_00_000Z)..optional.."Slot"(STRING, "the equipment piece's slot") + 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.."Charges"(INTEGER, "the amount of charges remaining on 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") + optional.."Stats"( + description = "contains information on the stats chosen if the item offers an option for stats/prefix", + type = record(name = "Stats", description = "Information about an item's stats.") { + CamelCase("id").."ID"(INTEGER, "the itemstat ID") + "Attributes"( + description = "the item's attributes", + type = record(name = "Attributes", description = "Information about an item's attributes.") { + 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("CritDamage").."CritDamage"(INTEGER, "the amount of crit damage 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") + } + ) + } + ) + since(V2_SCHEMA_2019_12_19T00_00_00_000Z).."Location"(STRING, "the storage location of the equipment piece") + since(V2_SCHEMA_2019_12_19T00_00_00_000Z)..optional.."Tabs"(array(INTEGER), "the IDs of the tabs in which this item is used") + }) + ) + }) + } V2_CHARACTERS_EQUIPMENTTABS( idTypeKey = "tab", summary = "Returns information about a character's equipment.", diff --git a/src/main/resources/com/gw2tb/apigen/v2_CharactersEquipment+2019-12-19T00_00_00.000Z.json b/src/main/resources/com/gw2tb/apigen/v2_CharactersEquipment+2019-12-19T00_00_00.000Z.json new file mode 100644 index 00000000..02285c7c --- /dev/null +++ b/src/main/resources/com/gw2tb/apigen/v2_CharactersEquipment+2019-12-19T00_00_00.000Z.json @@ -0,0 +1,326 @@ +[ + { + "equipment": [ + { + "id": 68357, + "slot": "HelmAquatic", + "stats": { + "id": 161, + "attributes": { + "Power": 60, + "Precision": 43, + "CritDamage": 43 + } + }, + "binding": "Character", + "bound_to": "Linux Die Bestie", + "location": "Equipped", + "tabs": [ + 1 + ] + }, + { + "id": 77536, + "slot": "Backpack", + "skin": 6892, + "stats": { + "id": 584, + "attributes": { + "Power": 63, + "Precision": 40, + "CritDamage": 40 + } + }, + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ], + "dyes": [ + null, + null, + null, + null + ] + }, + { + "id": 83036, + "slot": "Coat", + "upgrades": [ + 24836 + ], + "stats": { + "id": 161, + "attributes": { + "Power": 141, + "Precision": 101, + "CritDamage": 101 + } + }, + "binding": "Account", + "location": "EquippedFromLegendaryArmory", + "tabs": [ + 1 + ], + "dyes": [ + 473, + 473, + 443, + null + ] + }, + { + "id": 48078, + "slot": "Boots", + "upgrades": [ + 24836 + ], + "skin": 7486, + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ], + "dyes": [ + 473, + 473, + 473, + null + ] + }, + { + "id": 48080, + "slot": "Gloves", + "upgrades": [ + 24836 + ], + "skin": 6308, + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ], + "dyes": [ + 2, + 443, + 473, + 60 + ] + }, + { + "id": 82902, + "slot": "Helm", + "skin": 9544, + "stats": { + "id": 161, + "attributes": { + "Power": 63, + "Precision": 45, + "CritDamage": 45 + } + }, + "binding": "Account", + "location": "EquippedFromLegendaryArmory", + "tabs": [ + 1 + ], + "dyes": [ + 67, + 443, + 480, + null + ] + }, + { + "id": 83497, + "slot": "Leggings", + "upgrades": [ + 24836 + ], + "skin": 5726, + "stats": { + "id": 161, + "attributes": { + "Power": 94, + "Precision": 67, + "CritDamage": 67 + } + }, + "binding": "Account", + "location": "EquippedFromLegendaryArmory", + "tabs": [ + 1 + ], + "dyes": [ + 67, + 384, + 480, + null + ] + }, + { + "id": 48083, + "slot": "Shoulders", + "upgrades": [ + 24836 + ], + "skin": 7763, + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ], + "dyes": [ + 455, + 2, + null, + 443 + ] + }, + { + "id": 39232, + "slot": "Accessory1", + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ] + }, + { + "id": 94975, + "slot": "Accessory2", + "stats": { + "id": 584, + "attributes": { + "Power": 110, + "Precision": 74, + "CritDamage": 74 + } + }, + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ] + }, + { + "id": 49402, + "slot": "Ring1", + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ] + }, + { + "id": 49403, + "slot": "Ring2", + "binding": "Account", + "location": "Equipped", + "tabs": [ + 1 + ] + }, + { + "id": 95380, + "slot": "Amulet", + "stats": { + "id": 584, + "attributes": { + "Power": 157, + "Precision": 108, + "CritDamage": 108 + } + }, + "binding": "Account", + "location": "EquippedFromLegendaryArmory", + "tabs": [ + 1 + ] + }, + { + "id": 28430, + "slot": "WeaponAquaticA", + "upgrades": [ + 24554 + ], + "binding": "Character", + "bound_to": "Linux Die Bestie", + "location": "Equipped", + "tabs": [ + 1 + ] + }, + { + "id": 30698, + "slot": "WeaponA1", + "upgrades": [ + 24615, + 24554 + ], + "stats": { + "id": 161, + "attributes": { + "Power": 251, + "Precision": 179, + "CritDamage": 179 + } + }, + "binding": "Account", + "location": "EquippedFromLegendaryArmory", + "tabs": [ + 1 + ] + }, + { + "id": 17875, + "slot": "WeaponB1", + "upgrades": [ + 24641 + ], + "skin": 4877, + "binding": "Character", + "bound_to": "Linux Die Bestie", + "location": "Equipped", + "tabs": [ + 1 + ] + }, + { + "id": 30702, + "slot": "WeaponB2", + "stats": { + "id": 161, + "attributes": { + "Power": 125, + "Precision": 90, + "CritDamage": 90 + } + }, + "binding": "Account", + "location": "EquippedFromLegendaryArmory", + "tabs": [ + 1 + ] + }, + { + "id": 22997, + "slot": "Sickle", + "binding": "Account", + "location": "Equipped" + }, + { + "id": 23030, + "slot": "Axe", + "binding": "Account", + "location": "Equipped" + }, + { + "id": 23031, + "slot": "Pick", + "binding": "Account", + "location": "Equipped" + } + ] + } +] \ No newline at end of file diff --git a/src/main/resources/com/gw2tb/apigen/v2_CharactersEquipment.json b/src/main/resources/com/gw2tb/apigen/v2_CharactersEquipment.json new file mode 100644 index 00000000..5cb7693e --- /dev/null +++ b/src/main/resources/com/gw2tb/apigen/v2_CharactersEquipment.json @@ -0,0 +1,147 @@ +[ + { + "equipment": [ + { + "id": 68357, + "slot": "HelmAquatic", + "stats": { + "id": 161, + "attributes": { + "Power": 60, + "Precision": 43, + "CritDamage": 43 + } + }, + "binding": "Character", + "bound_to": "Linux Die Bestie" + }, + { + "id": 77536, + "slot": "Backpack", + "skin": 6892, + "stats": { + "id": 584, + "attributes": { + "Power": 63, + "Precision": 40, + "CritDamage": 40 + } + }, + "binding": "Account", + "dyes": [ + null, + null, + null, + null + ] + }, + { + "id": 48078, + "slot": "Boots", + "upgrades": [ + 24836 + ], + "skin": 7486, + "binding": "Account", + "dyes": [ + 473, + 473, + 473, + null + ] + }, + { + "id": 48080, + "slot": "Gloves", + "upgrades": [ + 24836 + ], + "skin": 6308, + "binding": "Account", + "dyes": [ + 2, + 443, + 473, + 60 + ] + }, + { + "id": 48083, + "slot": "Shoulders", + "upgrades": [ + 24836 + ], + "skin": 7763, + "binding": "Account", + "dyes": [ + 455, + 2, + null, + 443 + ] + }, + { + "id": 39232, + "slot": "Accessory1", + "binding": "Account" + }, + { + "id": 94975, + "slot": "Accessory2", + "stats": { + "id": 584, + "attributes": { + "Power": 110, + "Precision": 74, + "CritDamage": 74 + } + }, + "binding": "Account" + }, + { + "id": 49402, + "slot": "Ring1", + "binding": "Account" + }, + { + "id": 49403, + "slot": "Ring2", + "binding": "Account" + }, + { + "id": 28430, + "slot": "WeaponAquaticA", + "upgrades": [ + 24554 + ], + "binding": "Character", + "bound_to": "Linux Die Bestie" + }, + { + "id": 17875, + "slot": "WeaponB1", + "upgrades": [ + 24641 + ], + "skin": 4877, + "binding": "Character", + "bound_to": "Linux Die Bestie" + }, + { + "id": 22997, + "slot": "Sickle", + "binding": "Account" + }, + { + "id": 23030, + "slot": "Axe", + "binding": "Account" + }, + { + "id": 23031, + "slot": "Pick", + "binding": "Account" + } + ] + } +] \ 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 5b4e4cac..92973f97 100644 --- a/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v2.kt +++ b/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v2.kt @@ -429,6 +429,14 @@ class GW2v2 : SpecTest( ) ) + expectQuery( + "/Characters/:ID/Equipment", + security = setOf(ACCOUNT, BUILDS, CHARACTERS), + pathParameters = listOf( + ExpectedPathParameter("ID", STRING) + ) + ) + expectQuery( "/Characters/:ID/EquipmentTabs", security = setOf(ACCOUNT, BUILDS, CHARACTERS),