mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-30 22:54:32 +02:00
feat: use objects for /socials and /donations (#51)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
4d0de6e92e
commit
d4eac5c757
@ -1,13 +1,31 @@
|
|||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class WalletFields(BaseModel):
|
||||||
|
"""
|
||||||
|
Implements the fields for a crypto wallet.
|
||||||
|
"""
|
||||||
|
|
||||||
|
name: str
|
||||||
|
address: str
|
||||||
|
|
||||||
|
|
||||||
|
class LinkFields(BaseModel):
|
||||||
|
"""
|
||||||
|
Implements the fields for a donation link.
|
||||||
|
"""
|
||||||
|
|
||||||
|
name: str
|
||||||
|
url: str
|
||||||
|
|
||||||
|
|
||||||
class DonationFields(BaseModel):
|
class DonationFields(BaseModel):
|
||||||
"""
|
"""
|
||||||
A Pydantic BaseModel that represents all the donation links and wallets.
|
A Pydantic BaseModel that represents all the donation links and wallets.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
wallets: dict[str, str]
|
wallets: list[WalletFields]
|
||||||
links: dict[str, str]
|
links: list[LinkFields]
|
||||||
|
|
||||||
|
|
||||||
class DonationsResponseModel(BaseModel):
|
class DonationsResponseModel(BaseModel):
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class SocialField(BaseModel):
|
||||||
|
"""
|
||||||
|
Implements the fields for a social network link.
|
||||||
|
"""
|
||||||
|
|
||||||
|
name: str
|
||||||
|
url: str
|
||||||
|
|
||||||
|
|
||||||
class SocialsResponseModel(BaseModel):
|
class SocialsResponseModel(BaseModel):
|
||||||
"""
|
"""
|
||||||
A Pydantic BaseModel that represents a dictionary of social links.
|
A Pydantic BaseModel that represents a dictionary of social links.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
socials: dict[str, str]
|
socials: list[SocialField]
|
||||||
"""
|
"""
|
||||||
A dictionary where the keys are the names of the social networks, and
|
A dictionary where the keys are the names of the social networks, and
|
||||||
the values are the links to the profiles or pages.
|
the values are the links to the profiles or pages.
|
||||||
|
46
config.py
46
config.py
@ -1,32 +1,32 @@
|
|||||||
# Social Links
|
# Social Links
|
||||||
|
|
||||||
from email.policy import default
|
social_links: list[dict[str, str]] = [
|
||||||
|
{"name": "website", "url": "https://revanced.app"},
|
||||||
|
{"name": "github", "url": "https://github.com/revanced"},
|
||||||
social_links: dict[str, str] = {
|
{"name": "twitter", "url": "https://twitter.com/revancedapp"},
|
||||||
"website": "https://revanced.app",
|
{"name": "discord", "url": "https://revanced.app/discord"},
|
||||||
"github": "https://github.com/revanced",
|
{"name": "reddit", "url": "https://www.reddit.com/r/revancedapp"},
|
||||||
"twitter": "https://twitter.com/revancedapp",
|
{"name": "telegram", "url": "https://t.me/app_revanced"},
|
||||||
"discord": "https://revanced.app/discord",
|
{"name": "youtube", "url": "https://www.youtube.com/@ReVanced"},
|
||||||
"reddit": "https://www.reddit.com/r/revancedapp",
|
]
|
||||||
"telegram": "https://t.me/app_revanced",
|
|
||||||
"youtube": "https://www.youtube.com/@ReVanced",
|
|
||||||
}
|
|
||||||
|
|
||||||
# Donation info
|
# Donation info
|
||||||
|
|
||||||
wallets: dict[str, str] = {
|
wallets: list[dict[str, str]] = [
|
||||||
"btc": "bc1q4x8j6mt27y5gv0q625t8wkr87ruy8fprpy4v3f",
|
{"name": "btc", "address": "bc1q4x8j6mt27y5gv0q625t8wkr87ruy8fprpy4v3f"},
|
||||||
"doge": "D8GH73rNjudgi6bS2krrXWEsU9KShedLXp",
|
{"name": "doge", "address": "D8GH73rNjudgi6bS2krrXWEsU9KShedLXp"},
|
||||||
"eth": "0x7ab4091e00363654bf84B34151225742cd92FCE5",
|
{"name": "eth", "address": "0x7ab4091e00363654bf84B34151225742cd92FCE5"},
|
||||||
"ltc": "LbJi8EuoDcwaZvykcKmcrM74jpjde23qJ2",
|
{"name": "ltc", "address": "LbJi8EuoDcwaZvykcKmcrM74jpjde23qJ2"},
|
||||||
"xmr": "46YwWDbZD6jVptuk5mLHsuAmh1BnUMSjSNYacozQQEraWSQ93nb2yYVRHoMR6PmFYWEHsLHg9tr1cH5M8Rtn7YaaGQPCjSh",
|
{
|
||||||
}
|
"name": "xmr",
|
||||||
|
"address": "46YwWDbZD6jVptuk5mLHsuAmh1BnUMSjSNYacozQQEraWSQ93nb2yYVRHoMR6PmFYWEHsLHg9tr1cH5M8Rtn7YaaGQPCjSh",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
links: dict[str, str] = {
|
links: list[dict[str, str]] = [
|
||||||
"opencollective": "https://opencollective.com/revanced",
|
{"name": "Open Collective", "url": "https://opencollective.com/revanced"},
|
||||||
"github": "https://github.com/sponsors/ReVanced",
|
{"name": "Github Sponsors", "url": "https://github.com/sponsors/ReVanced"},
|
||||||
}
|
]
|
||||||
|
|
||||||
# API Configuration
|
# API Configuration
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user