Skip to content

Commit

Permalink
feat(spec): add /v1/event_details
Browse files Browse the repository at this point in the history
Closes #162
  • Loading branch information
TheMrMilchmann committed May 1, 2021
1 parent 3d03ab1 commit f335c37
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changelog/0.4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
41 changes: 41 additions & 0 deletions src/main/kotlin/com/gw2tb/apigen/internal/spec/GW2v1.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down
149 changes: 149 additions & 0 deletions src/main/resources/com/gw2tb/apigen/v1_event_details.json
Original file line number Diff line number Diff line change
@@ -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
]
]
}
}
}
}
5 changes: 5 additions & 0 deletions src/test/kotlin/com/gw2tb/apigen/test/spec/GW2v1.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ class GW2v1 : SpecTest<APIQuery.V1, APIType.V1, GW2v1.ExpectedAPIv1Query>(
V1SpecBuilder {
expectQuery("/Build")

expectQuery(
"/event_details",
isLocalized = true
)

expectQuery("/Files")

expectQuery(
Expand Down

0 comments on commit f335c37

Please sign in to comment.