mirror of
https://github.com/Radiquum/YAMPD.git
synced 2025-05-20 15:49:34 +05:00
add types and decouple packs functions from flask
This commit is contained in:
parent
ee133e9111
commit
f4d15c5eaf
7 changed files with 174 additions and 48 deletions
38
src/type/pack.py
Normal file
38
src/type/pack.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
import json
|
||||
from .mod import Mod
|
||||
|
||||
|
||||
class Pack:
|
||||
def __init__(
|
||||
self,
|
||||
_id: str,
|
||||
title: str,
|
||||
author: str,
|
||||
version: str,
|
||||
modloader: str,
|
||||
updateURL: str,
|
||||
mods: list[Mod],
|
||||
modpackVersion: int = 0,
|
||||
formatVersion: int = 0,
|
||||
):
|
||||
self._id = _id
|
||||
self.title = title
|
||||
self.author = author
|
||||
self.version = version
|
||||
self.modloader = modloader
|
||||
self.updateURL = updateURL
|
||||
self.mods = mods
|
||||
self.modpackVersion = modpackVersion
|
||||
self.formatVersion = formatVersion
|
||||
|
||||
def json(self):
|
||||
return {
|
||||
"title": self.title,
|
||||
"author": self.author,
|
||||
"version": self.version,
|
||||
"modloader": self.modloader,
|
||||
"updateURL": self.updateURL,
|
||||
"mods": self.mods,
|
||||
"modpackVersion": self.modpackVersion,
|
||||
"formatVersion": self.formatVersion,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue