2022-03-19 17:44:35 +00:00
|
|
|
from typing import List
|
|
|
|
from defs.format_time import strf_time
|
|
|
|
|
|
|
|
|
|
|
|
class Assets:
|
|
|
|
def __init__(self, data: dict):
|
|
|
|
self.name = data["name"]
|
|
|
|
self.url = data["downloadUrl"]
|
|
|
|
|
|
|
|
|
|
|
|
class Release:
|
|
|
|
def __init__(self, data: dict):
|
|
|
|
self.name: str = data["name"]
|
|
|
|
self.url: str = data["url"]
|
|
|
|
self.description: str = data["description"]
|
|
|
|
self.publishedAt: str = strf_time(data["publishedAt"])
|
|
|
|
self.tagName: str = data["tagName"]
|
|
|
|
self.isPrerelease: bool = data["isPrerelease"]
|
|
|
|
assets = []
|
|
|
|
if data["releaseAssets"]:
|
|
|
|
for i in data["releaseAssets"]:
|
|
|
|
assets.append(Assets(i))
|
|
|
|
self.releaseAssets: List[Assets] = assets
|
|
|
|
self.releaseAssetsLen = len(assets)
|
|
|
|
|
|
|
|
|
|
|
|
class Module:
|
|
|
|
def __init__(self, data: dict):
|
|
|
|
self.name: str = data["name"]
|
2022-03-20 05:02:17 +00:00
|
|
|
self.description: str = data["description"] if data["description"] else ""
|
|
|
|
self.url: str = data["url"] if data["url"] else ""
|
2022-03-19 17:44:35 +00:00
|
|
|
self.homepageUrl: str = data["homepageUrl"] if data["homepageUrl"] else data["url"]
|
2022-03-20 05:02:17 +00:00
|
|
|
self.sourceUrl: str = data["sourceUrl"] if data["sourceUrl"] else ""
|
2022-03-19 17:44:35 +00:00
|
|
|
self.hide: bool = data["hide"]
|
|
|
|
self.createdAt: str = strf_time(data["createdAt"])
|
|
|
|
text = []
|
|
|
|
for i in data["collaborators"]:
|
|
|
|
if i["name"]:
|
|
|
|
text.append(i["name"])
|
|
|
|
else:
|
|
|
|
text.append(i["login"])
|
|
|
|
self.collaborators: List[str] = text
|
|
|
|
self.latestRelease: str = data["latestRelease"]
|
|
|
|
releases = []
|
|
|
|
if data["releases"]:
|
|
|
|
for i in data["releases"]:
|
|
|
|
releases.append(Release(i))
|
|
|
|
self.releases: List[Release] = releases
|
2022-03-20 10:04:30 +00:00
|
|
|
self.updatedAt: str = releases[0].publishedAt if releases else strf_time(data["updatedAt"])
|
2022-03-20 05:02:17 +00:00
|
|
|
self.summary: str = data["summary"] if data["summary"] else ""
|
|
|
|
self.scope: List[str] = data["scope"] if data["scope"] else []
|
2022-03-19 17:44:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TrackMessage:
|
|
|
|
def __init__(self, text, url, name, button):
|
|
|
|
self.text = text
|
|
|
|
self.url = url
|
|
|
|
self.name = name
|
|
|
|
self.button = button
|