sonolus-models 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sonolus_models-0.1.1/.gitignore +10 -0
- sonolus_models-0.1.1/.python-version +1 -0
- sonolus_models-0.1.1/PKG-INFO +20 -0
- sonolus_models-0.1.1/README.md +1 -0
- sonolus_models-0.1.1/pyproject.toml +30 -0
- sonolus_models-0.1.1/sonolus_models/Request/ServerAuthenticateExternal.py +16 -0
- sonolus_models-0.1.1/sonolus_models/Request/ServerSubmitItemCommunityActionRequest.py +4 -0
- sonolus_models-0.1.1/sonolus_models/Request/ServerSubmitLevelResultRequest.py +9 -0
- sonolus_models-0.1.1/sonolus_models/Request/__init__.py +0 -0
- sonolus_models-0.1.1/sonolus_models/Request/authenticate.py +17 -0
- sonolus_models-0.1.1/sonolus_models/Response/ServerAuthenticateExternal.py +14 -0
- sonolus_models-0.1.1/sonolus_models/Response/ServerSubmitItemActionResponse.py +9 -0
- sonolus_models-0.1.1/sonolus_models/Response/ServerSubmitItemCommunityActionResponse.py +9 -0
- sonolus_models-0.1.1/sonolus_models/Response/ServerSubmitLevelResultResponse.py +8 -0
- sonolus_models-0.1.1/sonolus_models/Response/__init__.py +0 -0
- sonolus_models-0.1.1/sonolus_models/Response/authenticate.py +8 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemCommunityComment.py +9 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemCommunityCommentList.py +8 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemCommunityInfo.py +7 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemDetails.py +19 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemInfo.py +15 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemLeaderboardDetails.py +6 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemLeaderboardRecord.py +8 -0
- sonolus_models-0.1.1/sonolus_models/ServerItemList.py +14 -0
- sonolus_models-0.1.1/sonolus_models/ServerMessage.py +7 -0
- sonolus_models-0.1.1/sonolus_models/ServerOption.py +142 -0
- sonolus_models-0.1.1/sonolus_models/__init__.py +48 -0
- sonolus_models-0.1.1/sonolus_models/base.py +48 -0
- sonolus_models-0.1.1/sonolus_models/common.py +27 -0
- sonolus_models-0.1.1/sonolus_models/icon.py +76 -0
- sonolus_models-0.1.1/sonolus_models/items/__init__.py +64 -0
- sonolus_models-0.1.1/sonolus_models/items/background.py +26 -0
- sonolus_models-0.1.1/sonolus_models/items/effect.py +24 -0
- sonolus_models-0.1.1/sonolus_models/items/engine.py +27 -0
- sonolus_models-0.1.1/sonolus_models/items/level.py +42 -0
- sonolus_models-0.1.1/sonolus_models/items/particle.py +24 -0
- sonolus_models-0.1.1/sonolus_models/items/playlist.py +21 -0
- sonolus_models-0.1.1/sonolus_models/items/post.py +19 -0
- sonolus_models-0.1.1/sonolus_models/items/replay.py +16 -0
- sonolus_models-0.1.1/sonolus_models/items/skin.py +24 -0
- sonolus_models-0.1.1/sonolus_models/items/user.py +11 -0
- sonolus_models-0.1.1/sonolus_models/pack.py +32 -0
- sonolus_models-0.1.1/sonolus_models/sections/__init__.py +52 -0
- sonolus_models-0.1.1/sonolus_models/sections/base.py +17 -0
- sonolus_models-0.1.1/sonolus_models/server_info.py +45 -0
- sonolus_models-0.1.1/sonolus_models/sonolus_types.py +47 -0
- sonolus_models-0.1.1/sonolus_models/text.py +568 -0
- sonolus_models-0.1.1/sonolus_models/userprofile.py +24 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sonolus-models
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Define a Pydantic model for use within the Sonolus server and similar environments.
|
|
5
|
+
Project-URL: Homepage, https://github.com/yourusername/sonolus-models
|
|
6
|
+
Project-URL: Repository, https://github.com/yourusername/sonolus-models
|
|
7
|
+
Author-email: Your Name <your.email@example.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: models,pydantic,sonolus
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Requires-Dist: pydantic>=2.12.5
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# Sonolus-Models
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Sonolus-Models
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sonolus-models"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Define a Pydantic model for use within the Sonolus server and similar environments."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Your Name", email = "your.email@example.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["sonolus", "pydantic", "models"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"pydantic>=2.12.5",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/yourusername/sonolus-models"
|
|
30
|
+
Repository = "https://github.com/yourusername/sonolus-models"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from ..userprofile import ServiceUserProfile
|
|
3
|
+
|
|
4
|
+
class ServerAuthenticateExternalRequest(BaseModel):
|
|
5
|
+
"""
|
|
6
|
+
サーバー外部認証リクエストモデル
|
|
7
|
+
"""
|
|
8
|
+
type: str
|
|
9
|
+
url: str
|
|
10
|
+
time: int
|
|
11
|
+
user_profile: ServiceUserProfile = Field(..., alias='userProfile')
|
|
12
|
+
|
|
13
|
+
class Config:
|
|
14
|
+
populate_by_name = True
|
|
15
|
+
extra = 'ignore'
|
|
16
|
+
validate_by_name = True
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from ..userprofile import ServiceUserProfile
|
|
4
|
+
|
|
5
|
+
class ServerAuthenticateRequest(BaseModel):
|
|
6
|
+
"""
|
|
7
|
+
サーバー認証リクエストモデル
|
|
8
|
+
"""
|
|
9
|
+
type: str
|
|
10
|
+
address: str
|
|
11
|
+
time: int
|
|
12
|
+
user_profile: ServiceUserProfile = Field(..., alias='userProfile')
|
|
13
|
+
|
|
14
|
+
class Config:
|
|
15
|
+
populate_by_name = True
|
|
16
|
+
extra = 'ignore'
|
|
17
|
+
validate_by_name = True
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
|
|
3
|
+
class ServerAuthenticateExternalResponse(BaseModel):
|
|
4
|
+
"""
|
|
5
|
+
サーバー外部認証レスポンスモデル
|
|
6
|
+
"""
|
|
7
|
+
message: str = Field(..., description="サーバーメッセージ")
|
|
8
|
+
token: str = Field(..., description="認証トークン")
|
|
9
|
+
secret: str = Field(..., description="認証シークレット")
|
|
10
|
+
|
|
11
|
+
class Config:
|
|
12
|
+
populate_by_name = True
|
|
13
|
+
extra = 'ignore'
|
|
14
|
+
validate_by_name = True
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
class ServerSubmitItemActionResponse(BaseModel):
|
|
5
|
+
key: str
|
|
6
|
+
hashes: list[str]
|
|
7
|
+
shouldUpdateItem: Optional[bool] = None
|
|
8
|
+
shouldRemoveItem: Optional[bool] = None
|
|
9
|
+
shouldNavigateToItem: Optional[str] = None
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
class ServerSubmitItemCommunityActionResponse(BaseModel):
|
|
5
|
+
key: str
|
|
6
|
+
hashes: List[str]
|
|
7
|
+
shouldUpdateCommunity: Optional[bool] = None
|
|
8
|
+
shouldUpdateComments: Optional[bool] = None
|
|
9
|
+
shouldNavigateCommentsToPage: Optional[int] = None
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from .ServerItemCommunityComment import ServerItemCommunityComment
|
|
4
|
+
|
|
5
|
+
class ServerItemCommunityCommentList(BaseModel):
|
|
6
|
+
pageCount: int
|
|
7
|
+
cursor: Optional[str] = None
|
|
8
|
+
comments: list[ServerItemCommunityComment]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from .ServerItemCommunityComment import ServerItemCommunityComment
|
|
3
|
+
from .ServerOption import ServerForm
|
|
4
|
+
|
|
5
|
+
class ServerItemCommunityInfo(BaseModel):
|
|
6
|
+
actions: list[ServerForm] = []
|
|
7
|
+
topComments: list[ServerItemCommunityComment] = []
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import Generic, TypeVar, Optional, List, Union
|
|
3
|
+
from .ServerOption import ServerForm
|
|
4
|
+
from .sections import ServerItemSection
|
|
5
|
+
|
|
6
|
+
T = TypeVar('T')
|
|
7
|
+
|
|
8
|
+
class ServerItemLeaderboard(BaseModel):
|
|
9
|
+
name: str
|
|
10
|
+
title: str
|
|
11
|
+
description: Optional[str] = None
|
|
12
|
+
|
|
13
|
+
class ServerItemDetails(BaseModel, Generic[T]):
|
|
14
|
+
item: T
|
|
15
|
+
description: Optional[str] = None
|
|
16
|
+
actions: List[ServerForm] = Field(default_factory=list)
|
|
17
|
+
hasCommunity: bool
|
|
18
|
+
leaderboards: List[ServerItemLeaderboard] = Field(default_factory=list)
|
|
19
|
+
sections: List[ServerItemSection] = Field(default_factory=list)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import List, Dict, Any, Optional
|
|
3
|
+
from .base import SonolusResourceLocator
|
|
4
|
+
from .ServerOption import ServerForm
|
|
5
|
+
from .sections import ServerItemSection
|
|
6
|
+
|
|
7
|
+
class ServerItemInfo(BaseModel):
|
|
8
|
+
# https://wiki.sonolus.com/ja/custom-server-specs/endpoints/get-sonolus-type-info
|
|
9
|
+
"""
|
|
10
|
+
サーバーのアイテム情報を定義
|
|
11
|
+
"""
|
|
12
|
+
creates: List[ServerForm] = Field(default_factory=list)
|
|
13
|
+
searches: List[ServerForm] = Field(default_factory=list)
|
|
14
|
+
sections: List[ServerItemSection] = Field(default_factory=list)
|
|
15
|
+
banner: Optional[SonolusResourceLocator] = None
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import List, Dict, Any, Optional, Union, TypeVar
|
|
3
|
+
from .ServerOption import ServerForm
|
|
4
|
+
|
|
5
|
+
T = TypeVar('T')
|
|
6
|
+
|
|
7
|
+
class ServerItemList(BaseModel):
|
|
8
|
+
# https://wiki.sonolus.com/ja/custom-server-specs/endpoints/get-sonolus-type-list
|
|
9
|
+
"""
|
|
10
|
+
サーバーのアイテムリストを定義
|
|
11
|
+
"""
|
|
12
|
+
pageCount: int = Field(..., description="ページ数")
|
|
13
|
+
items: List[T] = Field(default_factory=list, description="アイテムのリスト") # 一ページ20個まで
|
|
14
|
+
searches: Optional[List[ServerForm]] = Field(None, description="検索フォームのリスト")
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import List, Dict, Any, Optional, Union, Literal
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
class ItemType(str, Enum):
|
|
6
|
+
"""アイテムタイプの定義"""
|
|
7
|
+
POST = "post"
|
|
8
|
+
PLAYLIST = "playlist"
|
|
9
|
+
LEVEL = "level"
|
|
10
|
+
SKIN = "skin"
|
|
11
|
+
BACKGROUND = "background"
|
|
12
|
+
EFFECT = "effect"
|
|
13
|
+
PARTICLE = "particle"
|
|
14
|
+
ENGINE = "engine"
|
|
15
|
+
REPLAY = "replay"
|
|
16
|
+
ROOM = "room"
|
|
17
|
+
|
|
18
|
+
class SelectValue(BaseModel):
|
|
19
|
+
"""セレクト/マルチオプションの値"""
|
|
20
|
+
name: str
|
|
21
|
+
title: Union[str, Dict[str, Any]] # Text型(多言語対応)またはstring
|
|
22
|
+
|
|
23
|
+
class ServerOptionBase(BaseModel):
|
|
24
|
+
"""全てのServerOptionの基底クラス"""
|
|
25
|
+
query: str
|
|
26
|
+
name: Union[str, Dict[str, Any]] # Text型(多言語対応)またはstring
|
|
27
|
+
description: Optional[str] = None
|
|
28
|
+
required: bool
|
|
29
|
+
|
|
30
|
+
class ServerTextOption(ServerOptionBase):
|
|
31
|
+
"""テキスト入力オプション"""
|
|
32
|
+
type: Literal["text"] = "text"
|
|
33
|
+
def_: str = Field(alias="def") # Pythonの予約語を回避
|
|
34
|
+
placeholder: Union[str, Dict[str, Any]]
|
|
35
|
+
limit: int
|
|
36
|
+
shortcuts: List[str]
|
|
37
|
+
class Config:
|
|
38
|
+
populate_by_name = True
|
|
39
|
+
|
|
40
|
+
class ServerTextAreaOption(ServerOptionBase):
|
|
41
|
+
"""テキストエリア入力オプション"""
|
|
42
|
+
type: Literal["textArea"] = "textArea"
|
|
43
|
+
def_: str = Field(alias="def")
|
|
44
|
+
placeholder: Union[str, Dict[str, Any]]
|
|
45
|
+
limit: int
|
|
46
|
+
shortcuts: List[str]
|
|
47
|
+
class Config:
|
|
48
|
+
populate_by_name = True
|
|
49
|
+
|
|
50
|
+
class ServerSliderOption(ServerOptionBase):
|
|
51
|
+
"""スライダー入力オプション"""
|
|
52
|
+
type: Literal["slider"] = "slider"
|
|
53
|
+
def_: float = Field(alias="def")
|
|
54
|
+
min: float
|
|
55
|
+
max: float
|
|
56
|
+
step: float
|
|
57
|
+
unit: Optional[Union[str, Dict[str, Any]]] = None
|
|
58
|
+
class Config:
|
|
59
|
+
populate_by_name = True
|
|
60
|
+
|
|
61
|
+
class ServerToggleOption(ServerOptionBase):
|
|
62
|
+
"""トグル(ON/OFF)オプション"""
|
|
63
|
+
type: Literal["toggle"] = "toggle"
|
|
64
|
+
def_: bool = Field(alias="def")
|
|
65
|
+
class Config:
|
|
66
|
+
populate_by_name = True
|
|
67
|
+
|
|
68
|
+
class ServerSelectOption(ServerOptionBase):
|
|
69
|
+
"""セレクト(単一選択)オプション"""
|
|
70
|
+
type: Literal["select"] = "select"
|
|
71
|
+
def_: str = Field(alias="def")
|
|
72
|
+
values: List[SelectValue]
|
|
73
|
+
class Config:
|
|
74
|
+
populate_by_name = True
|
|
75
|
+
|
|
76
|
+
class ServerMultiOption(ServerOptionBase):
|
|
77
|
+
"""マルチ(複数選択)オプション"""
|
|
78
|
+
type: Literal["multi"] = "multi"
|
|
79
|
+
def_: List[bool] = Field(alias="def")
|
|
80
|
+
values: List[SelectValue]
|
|
81
|
+
class Config:
|
|
82
|
+
populate_by_name = True
|
|
83
|
+
|
|
84
|
+
class ServerServerItemOption(ServerOptionBase):
|
|
85
|
+
"""サーバーアイテム(単一)オプション"""
|
|
86
|
+
type: Literal["serverItem"] = "serverItem"
|
|
87
|
+
item_type: ItemType = Field(alias="itemType")
|
|
88
|
+
def_: Optional[str] = Field(alias="def") # Sil型(簡略化してstringとする)
|
|
89
|
+
allow_other_servers: bool = Field(alias="allowOtherServers")
|
|
90
|
+
class Config:
|
|
91
|
+
populate_by_name = True
|
|
92
|
+
|
|
93
|
+
class ServerServerItemsOption(ServerOptionBase):
|
|
94
|
+
"""サーバーアイテム(複数)オプション"""
|
|
95
|
+
type: Literal["serverItems"] = "serverItems"
|
|
96
|
+
item_type: ItemType = Field(alias="itemType")
|
|
97
|
+
def_: List[str] = Field(alias="def") # Sil[]型(簡略化してList[string]とする)
|
|
98
|
+
allow_other_servers: bool = Field(alias="allowOtherServers")
|
|
99
|
+
limit: int
|
|
100
|
+
class Config:
|
|
101
|
+
populate_by_name = True
|
|
102
|
+
|
|
103
|
+
class ServerCollectionItemOption(ServerOptionBase):
|
|
104
|
+
"""コレクションアイテムオプション"""
|
|
105
|
+
type: Literal["collectionItem"] = "collectionItem"
|
|
106
|
+
item_type: ItemType = Field(alias="itemType")
|
|
107
|
+
class Config:
|
|
108
|
+
populate_by_name = True
|
|
109
|
+
|
|
110
|
+
class ServerFileOption(ServerOptionBase):
|
|
111
|
+
"""ファイルオプション"""
|
|
112
|
+
type: Literal["file"] = "file"
|
|
113
|
+
def_: str = Field(alias="def")
|
|
114
|
+
class Config:
|
|
115
|
+
populate_by_name = True
|
|
116
|
+
|
|
117
|
+
# Union型でServerOptionを定義
|
|
118
|
+
ServerOption = Union[
|
|
119
|
+
ServerTextOption,
|
|
120
|
+
ServerTextAreaOption,
|
|
121
|
+
ServerSliderOption,
|
|
122
|
+
ServerToggleOption,
|
|
123
|
+
ServerSelectOption,
|
|
124
|
+
ServerMultiOption,
|
|
125
|
+
ServerServerItemOption,
|
|
126
|
+
ServerServerItemsOption,
|
|
127
|
+
ServerCollectionItemOption,
|
|
128
|
+
ServerFileOption
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
class ServerForm(BaseModel):
|
|
132
|
+
"""サーバーフォームの定義"""
|
|
133
|
+
type: str
|
|
134
|
+
title: Union[str, Dict[str, Any]] # Text型(多言語対応)またはstring
|
|
135
|
+
icon: Optional[Union[str, Dict[str, Any]]] = None # Icon型(簡略化してstringまたはDict)
|
|
136
|
+
description: Optional[str] = None
|
|
137
|
+
help: Optional[str] = None
|
|
138
|
+
require_confirmation: bool = Field(alias="requireConfirmation")
|
|
139
|
+
options: List[ServerOption]
|
|
140
|
+
|
|
141
|
+
class Config:
|
|
142
|
+
validate_by_name = True
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from .base import *
|
|
2
|
+
from .common import *
|
|
3
|
+
from .icon import SonolusIcon
|
|
4
|
+
from .pack import *
|
|
5
|
+
from .server_info import *
|
|
6
|
+
|
|
7
|
+
from .ServerItemCommunityComment import ServerItemCommunityComment
|
|
8
|
+
from .ServerItemCommunityCommentList import ServerItemCommunityCommentList
|
|
9
|
+
from .ServerItemCommunityInfo import ServerItemCommunityInfo
|
|
10
|
+
from .ServerItemDetails import ServerItemDetails
|
|
11
|
+
from .ServerItemInfo import ServerItemInfo
|
|
12
|
+
from .ServerItemLeaderboardDetails import ServerItemLeaderboardDetails
|
|
13
|
+
from .ServerItemLeaderboardRecord import ServerItemLeaderboardRecord
|
|
14
|
+
from .ServerItemList import ServerItemList
|
|
15
|
+
from .ServerMessage import ServerMessage
|
|
16
|
+
from .ServerOption import ServerOption
|
|
17
|
+
|
|
18
|
+
from . import sonolus_types
|
|
19
|
+
from .text import SonolusText
|
|
20
|
+
from .userprofile import *
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
# core modules
|
|
24
|
+
"base", "common", "SonolusIcon", "pack", "server_info",
|
|
25
|
+
|
|
26
|
+
# server-related modules
|
|
27
|
+
"ServerItemCommunityComment",
|
|
28
|
+
"ServerItemCommunityCommentList",
|
|
29
|
+
"ServerItemCommunityInfo",
|
|
30
|
+
"ServerItemDetails",
|
|
31
|
+
"ServerItemInfo",
|
|
32
|
+
"ServerItemLeaderboardDetails",
|
|
33
|
+
"ServerItemLeaderboardRecord",
|
|
34
|
+
"ServerItemList",
|
|
35
|
+
"ServerMessage",
|
|
36
|
+
"ServerOption",
|
|
37
|
+
|
|
38
|
+
# base classes
|
|
39
|
+
"SonolusResourceLocator",
|
|
40
|
+
"SonolusButtonType",
|
|
41
|
+
"SonolusButton",
|
|
42
|
+
"SonolusConfiguration",
|
|
43
|
+
"SonolusServerInfo",
|
|
44
|
+
|
|
45
|
+
# helpers / types
|
|
46
|
+
"sonolus_types", "SonolusText", "userprofile",
|
|
47
|
+
]
|
|
48
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# ここでベースとなるモデルの定義
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
from typing import Dict, List, Optional, Any, Union
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from .ServerOption import ServerOption
|
|
7
|
+
|
|
8
|
+
class SonolusResourceLocator(BaseModel):
|
|
9
|
+
# https://wiki.sonolus.com/ja/custom-server-specs/misc/srl
|
|
10
|
+
|
|
11
|
+
hash: str
|
|
12
|
+
url: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SonolusButtonType(str, Enum):
|
|
16
|
+
# https://wiki.sonolus.com/ja/custom-server-specs/endpoints/get-sonolus-info
|
|
17
|
+
|
|
18
|
+
AUTHENTICATION = "authentication"
|
|
19
|
+
POST = "post"
|
|
20
|
+
LEVEL = "level"
|
|
21
|
+
SKIN = "skin"
|
|
22
|
+
BACKGROUND = "background"
|
|
23
|
+
EFFECT = "effect"
|
|
24
|
+
PARTICLE = "particle"
|
|
25
|
+
ENGINE = "engine"
|
|
26
|
+
CONFIGURATION = "configuration"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class SonolusButton(BaseModel):
|
|
30
|
+
# ボタンの定義
|
|
31
|
+
|
|
32
|
+
type: SonolusButtonType
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class SonolusConfiguration(BaseModel):
|
|
36
|
+
# サーバーの設定の情報
|
|
37
|
+
options: List[ServerOption] = Field(default_factory=list)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class SonolusServerInfo(BaseModel):
|
|
41
|
+
# サーバーの情報を定義
|
|
42
|
+
# Sonolusのサーバーに入ったときの最初のメニュー
|
|
43
|
+
|
|
44
|
+
title: str
|
|
45
|
+
description: Optional[str] = None
|
|
46
|
+
buttons: List[SonolusButton] = Field(default_factory=list)
|
|
47
|
+
configuration: SonolusConfiguration = Field(default_factory=SonolusConfiguration)
|
|
48
|
+
banner: Optional[SonolusResourceLocator] = None
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import Optional, Union, TypeVar, Generic, Annotated
|
|
3
|
+
from .base import SonolusResourceLocator
|
|
4
|
+
|
|
5
|
+
Text = Annotated[str, Field(description="テキスト型")]
|
|
6
|
+
|
|
7
|
+
Icon = Annotated[str, Field(description="アイコン型")]
|
|
8
|
+
|
|
9
|
+
class Tag(BaseModel):
|
|
10
|
+
"""タグ情報を提供"""
|
|
11
|
+
title: str
|
|
12
|
+
icon: Optional[str] = None
|
|
13
|
+
|
|
14
|
+
T = TypeVar('T')
|
|
15
|
+
|
|
16
|
+
class UseItemDefault(BaseModel):
|
|
17
|
+
"""デフォルトアイテムを使用"""
|
|
18
|
+
useDefault: bool = True
|
|
19
|
+
|
|
20
|
+
class UseItemCustom(BaseModel, Generic[T]):
|
|
21
|
+
"""カスタムアイテムを使用"""
|
|
22
|
+
useDefault: bool = False
|
|
23
|
+
item: T
|
|
24
|
+
|
|
25
|
+
def UseItem(item_type: T) -> Union[UseItemDefault, UseItemCustom[T]]:
|
|
26
|
+
"""UseItem型のファクトリー関数"""
|
|
27
|
+
return Union[UseItemDefault, UseItemCustom[item_type]]
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SonolusIcon(StrEnum):
|
|
5
|
+
Advanced = "advanced"
|
|
6
|
+
AngleDown = "angleDown"
|
|
7
|
+
AngleLeft = "angleLeft"
|
|
8
|
+
AngleRight = "angleRight"
|
|
9
|
+
AnglesDown = "anglesDown"
|
|
10
|
+
AnglesLeft = "anglesLeft"
|
|
11
|
+
AnglesRight = "anglesRight"
|
|
12
|
+
AnglesUp = "anglesUp"
|
|
13
|
+
AngleUp = "angleUp"
|
|
14
|
+
ArrowDown = "arrowDown"
|
|
15
|
+
ArrowLeft = "arrowLeft"
|
|
16
|
+
ArrowRight = "arrowRight"
|
|
17
|
+
ArrowUp = "arrowUp"
|
|
18
|
+
Award = "award"
|
|
19
|
+
Background = "background"
|
|
20
|
+
Bell = "bell"
|
|
21
|
+
BellSlash = "bellSlash"
|
|
22
|
+
Bookmark = "bookmark"
|
|
23
|
+
BookmarkHollow = "bookmarkHollow"
|
|
24
|
+
Check = "check"
|
|
25
|
+
Clock = "clock"
|
|
26
|
+
Comment = "comment"
|
|
27
|
+
Crown = "crown"
|
|
28
|
+
CustomServer = "customServer"
|
|
29
|
+
Delete = "delete"
|
|
30
|
+
Edit = "edit"
|
|
31
|
+
Effect = "effect"
|
|
32
|
+
Engine = "engine"
|
|
33
|
+
Envelope = "envelope"
|
|
34
|
+
EnvelopeOpen = "envelopeOpen"
|
|
35
|
+
Globe = "globe"
|
|
36
|
+
Heart = "heart"
|
|
37
|
+
HeartHollow = "heartHollow"
|
|
38
|
+
Hide = "hide"
|
|
39
|
+
Information = "information"
|
|
40
|
+
Level = "level"
|
|
41
|
+
Lock = "lock"
|
|
42
|
+
Medal = "medal"
|
|
43
|
+
Message = "message"
|
|
44
|
+
Minus = "minus"
|
|
45
|
+
Options = "options"
|
|
46
|
+
Particle = "particle"
|
|
47
|
+
Pin = "pin"
|
|
48
|
+
Player = "player"
|
|
49
|
+
Playlist = "playlist"
|
|
50
|
+
Plus = "plus"
|
|
51
|
+
Post = "post"
|
|
52
|
+
Question = "question"
|
|
53
|
+
Ranking = "ranking"
|
|
54
|
+
Replay = "replay"
|
|
55
|
+
Reply = "reply"
|
|
56
|
+
Restore = "restore"
|
|
57
|
+
Room = "room"
|
|
58
|
+
Search = "search"
|
|
59
|
+
Settings = "settings"
|
|
60
|
+
Show = "show"
|
|
61
|
+
Shuffle = "shuffle"
|
|
62
|
+
Skin = "skin"
|
|
63
|
+
Star = "star"
|
|
64
|
+
StarHalf = "starHalf"
|
|
65
|
+
StarHollow = "starHollow"
|
|
66
|
+
Stopwatch = "stopwatch"
|
|
67
|
+
Tag = "tag"
|
|
68
|
+
ThumbsDown = "thumbsDown"
|
|
69
|
+
ThumbsDownHollow = "thumbsDownHollow"
|
|
70
|
+
ThumbsUp = "thumbsUp"
|
|
71
|
+
ThumbsUpHollow = "thumbsUpHollow"
|
|
72
|
+
Trophy = "trophy"
|
|
73
|
+
Unlock = "unlock"
|
|
74
|
+
XMark = "xMark"
|
|
75
|
+
|
|
76
|
+
|