Added featured tag to support levels

This commit is contained in:
GP Garcia
2024-03-29 01:21:14 -05:00
parent 47659652d3
commit 0edc3e4437
5 changed files with 7 additions and 4 deletions

6
API.md
View File

@@ -130,7 +130,7 @@ Get a list of categories (needed for filtering assets) and potentially a login U
```http ```http
?type=(any|addon|project) ?type=(any|addon|project)
&category=(category id) &category=(category id)
&support=(official|community|testing) &support=(official|featured|community|testing)
&filter=(search text) &filter=(search text)
&user=(submitter username) &user=(submitter username)
&cost=(license) &cost=(license)
@@ -173,7 +173,7 @@ Get a list of assets.
Some notes: Some notes:
* Leading and trailing whitespace in `filter` is trimmed on the server side. * Leading and trailing whitespace in `filter` is trimmed on the server side.
* For legacy purposes, not supplying godot version would list only 2.1 assets, while not supplying type would list only addons. * For legacy purposes, not supplying godot version would list only 2.1 assets, while not supplying type would list only addons.
* To specify multiple support levels, join them with `+`, e.g. `support=official+community`. * To specify multiple support levels, join them with `+`, e.g. `support=featured+community`.
* Godot version can be specified as you see fit, for example, `godot_version=3.1` or `godot_version=3.1.5`. Currently, the patch version is disregarded, but may be honored in the future. * Godot version can be specified as you see fit, for example, `godot_version=3.1` or `godot_version=3.1.5`. Currently, the patch version is disregarded, but may be honored in the future.
<div id="api-get-asset-id"></div> <div id="api-get-asset-id"></div>
@@ -267,7 +267,7 @@ Revert a deletion of an asset. Useable by moderators and the owner of the asset.
### `POST /asset/{id}/support_level` ### `POST /asset/{id}/support_level`
```json ```json
{ {
"support_level": "official|community|testing", "support_level": "official|featured|community|testing",
"token": "…" "token": "…"
} }
``` ```

View File

@@ -30,6 +30,7 @@ return $constants = [
'testing' => 0, 'testing' => 0,
'community' => 1, 'community' => 1,
'official' => 2, 'official' => 2,
'featured' => 2,
]), ]),
'user_type' => double_map([ 'user_type' => double_map([
'normal' => 0, 'normal' => 0,

View File

@@ -99,7 +99,7 @@ $app->get('/asset', function ($request, $response, $args) {
} }
if (count($support_levels) === 0) { if (count($support_levels) === 0) {
$support_levels = [0, 1, 2]; // Testing + Community + Official $support_levels = [0, 1, 2]; // Testing + Community + Official / Featured
} }
$support_levels = implode('|', $support_levels); $support_levels = implode('|', $support_levels);

View File

@@ -18,6 +18,7 @@
<span class="label label-info"><?php echo esc(ucfirst(str_replace('_', ' ', $data['godot_version']))) ?></span> <span class="label label-info"><?php echo esc(ucfirst(str_replace('_', ' ', $data['godot_version']))) ?></span>
<span class="label label-<?php echo raw([ <span class="label label-<?php echo raw([
'official' => 'danger', 'official' => 'danger',
'featured' => 'danger',
'community' => 'success', 'community' => 'success',
'testing' => 'default', 'testing' => 'default',
][$data['support_level']]) ?>"><?php echo esc(ucfirst($data['support_level'])) ?></span> ][$data['support_level']]) ?>"><?php echo esc(ucfirst($data['support_level'])) ?></span>

View File

@@ -114,6 +114,7 @@
<span class="label label-info"><?php echo esc(ucfirst(str_replace('_', ' ', $asset['godot_version']))) ?></span> <span class="label label-info"><?php echo esc(ucfirst(str_replace('_', ' ', $asset['godot_version']))) ?></span>
<span class="label label-<?php echo raw([ <span class="label label-<?php echo raw([
'official' => 'danger', 'official' => 'danger',
'featured' => 'danger',
'community' => 'success', 'community' => 'success',
'testing' => 'default', 'testing' => 'default',
][$asset['support_level']]) ?>"><?php echo esc(ucfirst($asset['support_level'])) ?></span> ][$asset['support_level']]) ?>"><?php echo esc(ucfirst($asset['support_level'])) ?></span>