mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
/dev/api: Show /api/flairselector docs
This commit is contained in:
@@ -3209,7 +3209,18 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
@validate(VUser(),
|
||||
user = VFlairAccount('name'),
|
||||
link = VFlairLink('link'))
|
||||
@api_doc(api_section.flair, uses_site=True)
|
||||
def POST_flairselector(self, user, link):
|
||||
"""Return information about a users's flair options.
|
||||
|
||||
If `link` is given, return link flair options.
|
||||
Otherwise, return user flair options for this subreddit.
|
||||
|
||||
The logged in user's flair is also returned.
|
||||
Subreddit moderators may give a user by `name` to instead
|
||||
retrieve that user's flair.
|
||||
|
||||
"""
|
||||
if link:
|
||||
if hasattr(c.site, '_id') and c.site._id == link.sr_id:
|
||||
site = c.site
|
||||
|
||||
@@ -2149,6 +2149,9 @@ class VFlairAccount(VRequired):
|
||||
or self._lookup(name, True)
|
||||
or self.error())
|
||||
|
||||
def param_docs(self):
|
||||
return {self.param: _("a user by name")}
|
||||
|
||||
class VFlairLink(VRequired):
|
||||
def __init__(self, item, *a, **kw):
|
||||
VRequired.__init__(self, item, errors.BAD_FLAIR_TARGET, *a, **kw)
|
||||
@@ -2161,6 +2164,9 @@ class VFlairLink(VRequired):
|
||||
except NotFound:
|
||||
return self.error()
|
||||
|
||||
def param_docs(self):
|
||||
return {self.param: _("a [fullname](#fullname) of a link")}
|
||||
|
||||
class VFlairCss(VCssName):
|
||||
def __init__(self, param, max_css_classes=10, **kw):
|
||||
self.max_css_classes = max_css_classes
|
||||
|
||||
Reference in New Issue
Block a user