Update tests
This commit is contained in:
@ -1,29 +1,38 @@
|
||||
class Banner:
|
||||
"""Contains a launcher banner information
|
||||
class Post:
|
||||
"""Contains a launcher post information
|
||||
|
||||
Note that the banner name is in chinese, so you may not find this variable useful.
|
||||
Also, the banner has a variable called `order`, you can use that to sort the banner
|
||||
like the official launcher does.
|
||||
The `type` variable can be POST_TYPE_ANNOUNCE, POST_TYPE_ACTIVITY and POST_TYPE_INFO
|
||||
where announce is an announcement, activity is an activity/event and info is an information.
|
||||
|
||||
The `show_time` variable is the time in DD/MM format when the post will be shown.
|
||||
|
||||
Also, `tittle` is not my typo, and it's the server intention (probably there are clients
|
||||
where their developers wrote `tittle` instead of `title`), and the post has a variable
|
||||
called `order`, you can use that to sort the post like the official launcher does.
|
||||
|
||||
Attributes:
|
||||
|
||||
- :class:`str` banner_id: The launcher banner id.
|
||||
- :class:`str` name: The banner name.
|
||||
- :class:`str` img: The banner image url.
|
||||
- :class:`str` url: The banner target url.
|
||||
- :class:`str` order: The banner order.
|
||||
- :class:`str` name: The banner name.
|
||||
- :class:`str` post_id: The launcher post id.
|
||||
- :class:`str` type: The post type, as explained above.
|
||||
- :class:`str` tittle: The post title.
|
||||
- :class:`str` url: The post target url.
|
||||
- :class:`str` show_time: The time when the post will be shown.
|
||||
- :class:`str` order: The post order.
|
||||
- :class:`str` title: The post title.
|
||||
- :class:`dict` raw: The banner raw information.
|
||||
"""
|
||||
def __init__(self, banner_id, name, img, url, order, raw):
|
||||
self.banner_id = banner_id
|
||||
self.name = name
|
||||
self.img = img
|
||||
def __init__(self, post_id, post_type, tittle, url, show_time, order, title, raw):
|
||||
self.post_id = post_id
|
||||
self.type = post_type # Shadow built-in name `type`
|
||||
self.tittle = tittle
|
||||
self.url = url
|
||||
self.show_time = show_time
|
||||
self.order = order
|
||||
self.title = title
|
||||
self.raw = raw
|
||||
|
||||
@staticmethod
|
||||
def from_dict(data) -> 'Banner':
|
||||
"""Creates a launcher banner from a dictionary."""
|
||||
return Banner(data["banner_id"], data["name"], data["img"], data["url"], data["order"], data)
|
||||
def from_dict(data) -> 'Post':
|
||||
"""Creates a launcher post from a dictionary."""
|
||||
return Post(data["post_id"], data["type"], data["tittle"], data["url"],
|
||||
data["show_time"], data["order"], data["title"], data)
|
||||
|
||||
Reference in New Issue
Block a user