Add is_protected and views to Tags API

This commit is contained in:
rubenwardy 2022-01-29 19:26:55 +00:00
parent 4f9ec2e8a4
commit bdd3ab4360
2 changed files with 12 additions and 4 deletions

@ -330,9 +330,11 @@ Supported query parameters:
### Tags
* GET `/api/tags/` ([View](/api/tags/)): List of:
* `name`: technical name
* `title`: human-readable title
* `description`: tag description or null
* `name`: technical name.
* `title`: human-readable title.
* `description`: tag description or null.
* `is_protected`: boolean, whether the tag is protected (can only be set by Editors in the web interface).
* `views`: number of views of this tag.
### Content Warnings

@ -818,7 +818,13 @@ class Tag(db.Model):
def getAsDictionary(self):
description = self.description if self.description != "" else None
return { "name": self.name, "title": self.title, "description": description }
return {
"name": self.name,
"title": self.title,
"description": description,
"is_protected": self.is_protected,
"views": self.views,
}
class MinetestRelease(db.Model):