From f335c37030669be613ca8a6a940279aeb8f6d336 Mon Sep 17 00:00:00 2001 From: Leon Linhart Date: Sat, 1 May 2021 17:55:35 +0200 Subject: [PATCH] feat(spec): add /v1/event_details Closes #162 --- docs/changelog/0.4.0.md | 1 + .../com/gw2tb/apigen/internal/spec/GW2v1.kt | 41 +++++ .../com/gw2tb/apigen/v1_event_details.json | 149 ++++++++++++++++++ .../com/gw2tb/apigen/test/spec/GW2v1.kt | 5 + 4 files changed, 196 insertions(+) create mode 100644 src/main/resources/com/gw2tb/apigen/v1_event_details.json diff --git a/docs/changelog/0.4.0.md b/docs/changelog/0.4.0.md index 3b42e0cf..f598b207 100644 --- a/docs/changelog/0.4.0.md +++ b/docs/changelog/0.4.0.md @@ -6,6 +6,7 @@ _Not Released Yet_ - Endpoints: - Added support for `/v1/build`. [[GH-159](https://github.com/GW2ToolBelt/api-generator/issues/159)] + - Added support for `/v1/event_details`. [[GH-162](https://github.com/GW2ToolBelt/api-generator/issues/162)] - Added support for `/v1/files`. [[GH-164](https://github.com/GW2ToolBelt/api-generator/issues/164)] - Added support for `/v1/map_names`. [[GH-169](https://github.com/GW2ToolBelt/api-generator/issues/169)] - Added support for `/v1/skin_details`. [[GH-158](https://github.com/GW2ToolBelt/api-generator/issues/158)] diff --git a/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v1.kt b/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v1.kt index 25d87411..f2b26cca 100644 --- a/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v1.kt +++ b/src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v1.kt @@ -33,6 +33,47 @@ internal val GW2v1 = GW2APIVersion({ APIVersionBuilder.V1() }) { SerialName("build_id").."BuildID"(INTEGER, "the current build ID") }) } + "/event_details"(endpoint = "EventDetails") { + summary = "Returns information about the events in the game." + + schema(record(name = "EventDetails", description = "Information about events.") { + "Events"( + description = "the events", + type = map( + keys = STRING, + values = record(name = "EventDetails", description = "Information about an event.") { + localized.."Name"(STRING, "the event's name") + "Level"(INTEGER, "the event's level") + SerialName("map_id").."MapID"(INTEGER, "the ID of the map where the event takes place") + "Flags"(array(STRING), "additional information about the event (e.g. group_event, map_wide, meta_event, dungeon_event)") + "Location"( + description = "the event's location", + type = conditional(name = "Location", description = "Information about an event's location.", sharedConfigure = { + "Type"(STRING, "the type of location") + }) { + "cylinder"(record(name = "Cylinder", description = "Information about a cylindrical event location.") { + "Center"(array(DECIMAL), "the coordinates (x,y,z) of the cylinder's center (in map coordinates)") + "Height"(DECIMAL, "the cylinder's height") + "Radius"(DECIMAL, "the cylinder's radius") + "Rotation"(DECIMAL, "the cylinder's rotation") + }) + "poly"(record(name = "Poly", description = "Information about a polygonal event location.") { + "Center"(array(DECIMAL), "the coordinates (x,y,z) of the polygon's center (in map coordinates)") + SerialName("z_range").."ZRange"(array(DECIMAL), "the polygon's z-range") + "Points"(array(array(DECIMAL)), "the polygon's points") + }) + "sphere"(record(name = "Sphere", description = "Information about a spherical event location.") { + "Center"(array(DECIMAL), "the coordinates (x,y,z) of the sphere's center (in map coordinates)") + "Radius"(DECIMAL, "the sphere's radius") + "Rotation"(DECIMAL, "the sphere's rotation") + }) + } + ) + } + ) + ) + }) + } "/Files" { summary = "Returns commonly requested in-game assets." diff --git a/src/main/resources/com/gw2tb/apigen/v1_event_details.json b/src/main/resources/com/gw2tb/apigen/v1_event_details.json new file mode 100644 index 00000000..194e9d7f --- /dev/null +++ b/src/main/resources/com/gw2tb/apigen/v1_event_details.json @@ -0,0 +1,149 @@ +{ + "events": { + "88BEACB7-3064-4489-8B9A-DD6A3370186F": { + "name": "Defeat the holograms!", + "level": 0, + "map_id": 26, + "flags": [], + "location": { + "type": "sphere", + "center": [ + 4838.1, + 35552.4, + -6391.19 + ], + "radius": 3000, + "rotation": 0 + } + }, + "E5BF70E5-7219-479D-9C65-650E85745DDA": { + "name": "Defend Stygian Deeps from the Risen krait.", + "level": 72, + "map_id": 51, + "flags": [], + "location": { + "type": "cylinder", + "center": [ + 6678.13, + 7279.49, + 938.506 + ], + "height": 3797.76, + "radius": 3500, + "rotation": 0 + } + }, + "EED8A79F-B374-4AE6-BA6F-B7B98D9D7142": { + "name": "Defeat the renegade charr.", + "level": 42, + "map_id": 20, + "flags": [], + "location": { + "type": "sphere", + "center": [ + -9463.6, + -40310.2, + -785.799 + ], + "radius": 2500, + "rotation": 0 + } + }, + "4A750A61-4BDA-4991-90A4-EFB4EAA5F33A": { + "name": "Intimidate creatures and tame them with a flute.", + "level": 80, + "map_id": 1211, + "flags": [], + "location": { + "type": "poly", + "center": [ + 21444, + 566.36, + -6078.84 + ], + "z_range": [ + -6887.83, + -5269.86 + ], + "points": [ + [ + 19146.3, + -6919.47 + ], + [ + 18251.3, + -5300.14 + ], + [ + 17382.5, + -2885.75 + ], + [ + 17452, + -313.54 + ], + [ + 17427.1, + 1712.78 + ], + [ + 17573.4, + 5072.41 + ], + [ + 18436.3, + 6111.05 + ], + [ + 20932.3, + 7983.99 + ], + [ + 21885.2, + 10445.8 + ], + [ + 23377.9, + 9451.03 + ], + [ + 21137.5, + 2751.94 + ], + [ + 21598.3, + 1246.58 + ], + [ + 24532.1, + 691.173 + ], + [ + 25795.4, + 1456.99 + ], + [ + 26252.7, + 411.27 + ], + [ + 25554.9, + -2667.15 + ], + [ + 25638.3, + -4669.68 + ], + [ + 23937.1, + -6445.73 + ], + [ + 21125.4, + -7372.72 + ] + ] + } + } + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v1.kt b/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v1.kt index c45b8ef9..a16102c0 100644 --- a/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v1.kt +++ b/src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v1.kt @@ -37,6 +37,11 @@ class GW2v1 : SpecTest( V1SpecBuilder { expectQuery("/Build") + expectQuery( + "/event_details", + isLocalized = true + ) + expectQuery("/Files") expectQuery(