Skip to content

Commit 27b626a

Browse files
committed
feat: support for multivalue k/v pairs
1 parent 33c2c52 commit 27b626a

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

docs/APIContract.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,22 @@ The base URL for an API should be: _baseURL_/_apiVersion_/ meaning even somethin
99
In order to provide a consistent API a metadata endpoint should be provided under _baseURL_/.well-known/pathofbuilding this endpoint should provide information about the API and the version of the API.
1010
Furthermore this may allow having custom endpoints for the API.
1111

12-
| Feature | Field | Type | Description |
13-
| ---------------- | ------------- | ---- | --------------------------------------------------------------------------------- |
14-
| League Filtering | league_filter | bool | This can be used to indicate whether the API supports filtering based on leagues |
15-
| Gem Filtering | gem_filter | bool | This can be used to indicate whether the API supports filtering based on gems |
12+
| Feature | Field | Type | Description |
13+
| ---------------- | ------------- | ------------ | --------------------------------------------------------------------------------- |
14+
| League Filtering | league_filter | bool | This can be used to indicate whether the API supports filtering based on leagues |
15+
| Gem Filtering | gem_filter | bool | This can be used to indicate whether the API supports filtering based on gems |
16+
| Streams | streams | StreamInfo[] | A list of streams available to be queried against |
17+
18+
### Types
19+
20+
#### StreamInfo
21+
22+
| Field | Type | Description |
23+
| ------- | ------ | ------------------------------- |
24+
| name | string | Name of the stream |
25+
| apiPath | string | API path to the stream endpoint |
26+
27+
apiPath might be changed to a generic endpoint such as `/v1/{stream}/builds`
1628

1729
## Version 1
1830

@@ -30,7 +42,7 @@ Furthermore this may allow having custom endpoints for the API.
3042
### Endpoints
3143

3244
<details>
33-
<summary><code>GET</code> <code><b>/v1/builds</b></code> <code>(Lists multiple builds)</code></summary>
45+
<summary><code>GET</code> <code><b>/v1/{stream}/builds</b></code> <code>(Lists multiple builds)</code></summary>
3446

3547
#### Parameters
3648
> Query Parameters
@@ -43,19 +55,19 @@ Furthermore this may allow having custom endpoints for the API.
4355

4456
##### League
4557

46-
The values should be matching what Grinding Gear Games will be using for the teaser part of the website, such as: _https://www.pathofexile.com/settlers_ or _https://www.pathofexile.com/affliction_. This allows for easier mapping of the data as neither PoB nor the API will be required to wait for either party.
58+
These values will just be the base patch version for the league.
4759

4860
These links are generally available via poewiki see: https://www.poewiki.net/wiki/Necropolis_league _Official Page_.
4961

5062
Example values:
5163

52-
| Patch | League | value | url |
53-
| ----- | ---------------------- | ---------- | -------------------------------------- |
54-
| 3.25 | Settlers of Kalguur | settlers | https://www.pathofexile.com/settlers |
55-
| 3.24 | Necropolis | necropolis | https://www.pathofexile.com/necropolis |
56-
| 3.23 | Affliction | affliction | https://www.pathofexile.com/affliction |
57-
| 3.22 | Trial of the Ancestors | ancestor | https://www.pathofexile.com/ancestor |
58-
| 3.4 | Delve | delve | https://www.pathofexile.com/delve |
64+
| Patch | League | value | url |
65+
| ----- | ---------------------- | ----- | -------------------------------------- |
66+
| 3.25 | Settlers of Kalguur | 3.25 | https://www.pathofexile.com/settlers |
67+
| 3.24 | Necropolis | 3.24 | https://www.pathofexile.com/necropolis |
68+
| 3.23 | Affliction | 3.23 | https://www.pathofexile.com/affliction |
69+
| 3.22 | Trial of the Ancestors | 3.22 | https://www.pathofexile.com/ancestor |
70+
| 3.4 | Delve | 3.4 | https://www.pathofexile.com/delve |
5971

6072
#### Responses
6173

src/Classes/APIContractBuilds.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ local function tableToQueryParams(t)
8181
local query = "?"
8282
for key, value in pairs(t) do
8383
if value then
84+
local tempValue = value
85+
if type(value) == "table" then
86+
tempValue = table.concat(value, ",")
87+
end
8488
query = query .. key .. "=" .. value .. "&"
8589
end
8690
end

0 commit comments

Comments
 (0)