mc5-api-client 1.0.16__py3-none-any.whl → 1.0.18__py3-none-any.whl

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.
@@ -0,0 +1,234 @@
1
+ # ────────────[ CHIZOBA ]────────────────────────────
2
+ # | Email : chizoba2026@hotmail.com
3
+ # | File : pc_storage_quick.py
4
+ # | License : MIT License © 2026 Chizoba
5
+ # | Brief | Quick functions for PC storage admin
6
+ # ────────────────★─────────────────────────────────
7
+
8
+ """
9
+ Quick functions for PC Storage Admin operations.
10
+ Provides simple one-liner functions for common storage admin tasks.
11
+ """
12
+
13
+ from typing import Optional, Dict, Any, List
14
+ from .pc_storage_client import PCStorageClient
15
+
16
+
17
+ def quick_get_squad_storage_info(squad_id: str) -> Optional[Dict[str, Any]]:
18
+ """
19
+ Quick function to get squad storage information.
20
+
21
+ Args:
22
+ squad_id: Squad ID to retrieve
23
+
24
+ Returns:
25
+ Squad storage information or None if failed
26
+ """
27
+ try:
28
+ client = PCStorageClient()
29
+ client.authenticate()
30
+ return client.get_squad_storage_info(squad_id)
31
+ except Exception:
32
+ return None
33
+
34
+
35
+ def quick_update_squad_storage(
36
+ squad_id: str,
37
+ name: Optional[str] = None,
38
+ description: Optional[str] = None,
39
+ rating: Optional[int] = None,
40
+ member_limit: Optional[int] = None,
41
+ privacy: Optional[str] = None
42
+ ) -> bool:
43
+ """
44
+ Quick function to update squad storage information.
45
+
46
+ Args:
47
+ squad_id: Squad ID to update
48
+ name: New squad name
49
+ description: New squad description
50
+ rating: New squad rating
51
+ member_limit: New member limit
52
+ privacy: Privacy settings
53
+
54
+ Returns:
55
+ True if successful, False otherwise
56
+ """
57
+ try:
58
+ client = PCStorageClient()
59
+ client.authenticate()
60
+ result = client.update_squad_storage(
61
+ squad_id=squad_id,
62
+ name=name,
63
+ description=description,
64
+ rating=rating,
65
+ member_limit=member_limit,
66
+ privacy=privacy
67
+ )
68
+ return True
69
+ except Exception:
70
+ return False
71
+
72
+
73
+ def quick_delete_squad(squad_id: str) -> bool:
74
+ """
75
+ Quick function to delete a squad (requires storage_admin scope).
76
+
77
+ Args:
78
+ squad_id: Squad ID to delete
79
+
80
+ Returns:
81
+ True if successful, False otherwise
82
+ """
83
+ try:
84
+ client = PCStorageClient()
85
+ client.authenticate()
86
+ result = client.delete_squad(squad_id)
87
+ return True
88
+ except Exception:
89
+ return False
90
+
91
+
92
+ def quick_get_all_squads(limit: int = 50) -> Optional[List[Dict[str, Any]]]:
93
+ """
94
+ Quick function to get all squads.
95
+
96
+ Args:
97
+ limit: Number of squads to retrieve
98
+
99
+ Returns:
100
+ List of squads or None if failed
101
+ """
102
+ try:
103
+ client = PCStorageClient()
104
+ client.authenticate()
105
+ result = client.get_all_squads(limit=limit)
106
+ return result.get('squads', []) if isinstance(result, dict) else result
107
+ except Exception:
108
+ return None
109
+
110
+
111
+ def quick_batch_delete_squads(squad_ids: List[str]) -> Dict[str, Any]:
112
+ """
113
+ Quick function to delete multiple squads.
114
+
115
+ Args:
116
+ squad_ids: List of squad IDs to delete
117
+
118
+ Returns:
119
+ Batch deletion results
120
+ """
121
+ try:
122
+ client = PCStorageClient()
123
+ client.authenticate()
124
+ return client.batch_delete_squads(squad_ids)
125
+ except Exception as e:
126
+ return {"error": str(e)}
127
+
128
+
129
+ def quick_transfer_squad_ownership(
130
+ squad_id: str,
131
+ new_owner_credential: str
132
+ ) -> bool:
133
+ """
134
+ Quick function to transfer squad ownership.
135
+
136
+ Args:
137
+ squad_id: Squad ID to transfer
138
+ new_owner_credential: New owner's credential
139
+
140
+ Returns:
141
+ True if successful, False otherwise
142
+ """
143
+ try:
144
+ client = PCStorageClient()
145
+ client.authenticate()
146
+ result = client.transfer_squad_ownership(squad_id, new_owner_credential)
147
+ return True
148
+ except Exception:
149
+ return False
150
+
151
+
152
+ def quick_get_squad_audit_log(squad_id: str, limit: int = 20) -> Optional[List[Dict[str, Any]]]:
153
+ """
154
+ Quick function to get squad audit log.
155
+
156
+ Args:
157
+ squad_id: Squad ID to get audit log for
158
+ limit: Number of audit entries to retrieve
159
+
160
+ Returns:
161
+ Audit log entries or None if failed
162
+ """
163
+ try:
164
+ client = PCStorageClient()
165
+ client.authenticate()
166
+ result = client.get_squad_audit_log(squad_id, limit=limit)
167
+ return result.get('entries', []) if isinstance(result, dict) else result
168
+ except Exception:
169
+ return None
170
+
171
+
172
+ def quick_squad_management_report(squad_id: str) -> Optional[Dict[str, Any]]:
173
+ """
174
+ Quick function to generate comprehensive squad management report.
175
+
176
+ Args:
177
+ squad_id: Squad ID to analyze
178
+
179
+ Returns:
180
+ Comprehensive squad report or None if failed
181
+ """
182
+ try:
183
+ client = PCStorageClient()
184
+ client.authenticate()
185
+ return client.quick_squad_management_report(squad_id)
186
+ except Exception:
187
+ return None
188
+
189
+
190
+ def quick_check_storage_capabilities() -> Optional[Dict[str, Any]]:
191
+ """
192
+ Quick function to check current storage capabilities.
193
+
194
+ Returns:
195
+ Storage capabilities information or None if failed
196
+ """
197
+ try:
198
+ client = PCStorageClient()
199
+ client.authenticate()
200
+ return client.get_storage_info()
201
+ except Exception:
202
+ return None
203
+
204
+
205
+ def quick_analyze_squad(squad_id: str) -> Optional[Dict[str, Any]]:
206
+ """
207
+ Quick function to analyze squad with all available storage data.
208
+
209
+ Args:
210
+ squad_id: Squad ID to analyze
211
+
212
+ Returns:
213
+ Squad analysis results or None if failed
214
+ """
215
+ try:
216
+ client = PCStorageClient()
217
+ client.authenticate()
218
+
219
+ # Get comprehensive squad data
220
+ squad_info = client.get_squad_storage_info(squad_id)
221
+ audit_log = client.get_squad_audit_log(squad_id, limit=10)
222
+
223
+ return {
224
+ "squad_id": squad_id,
225
+ "squad_info": squad_info,
226
+ "audit_log": audit_log,
227
+ "analysis": {
228
+ "has_data": bool(squad_info),
229
+ "has_audit_log": bool(audit_log),
230
+ "available_actions": client._get_available_actions(squad_id)
231
+ }
232
+ }
233
+ except Exception:
234
+ return None
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env python3
2
+ # ────────────[ CHIZOBA ]────────────────────────────
3
+ # | Email : chizoba2026@hotmail.com
4
+ # | File : platform.py
5
+ # | License : MIT License 2026 Chizoba
6
+ # | Brief : Platform support for MC5 API Client (PC & Android)
7
+ # ────────────────★─────────────────────────────────
8
+
9
+ from enum import Enum
10
+ from typing import Dict, Any, Optional
11
+ import random
12
+ import string
13
+
14
+ class Platform(Enum):
15
+ """Supported platforms for MC5 API."""
16
+ PC = "pc"
17
+ ANDROID = "android"
18
+
19
+ class PlatformConfig:
20
+ """Configuration for different platforms."""
21
+
22
+ def __init__(self, platform: Platform):
23
+ self.platform = platform
24
+ self._config = self._get_platform_config()
25
+
26
+ def _get_platform_config(self) -> Dict[str, Any]:
27
+ """Get platform-specific configuration."""
28
+ configs = {
29
+ Platform.PC: {
30
+ "client_id": "1924:56128:6.0.6a:pc:steam",
31
+ "device_model": "Windows PC",
32
+ "device_resolution": "1920x1080",
33
+ "device_country": "US",
34
+ "device_language": "en",
35
+ "user_agent": "MC5-PC-Client/1.0.16",
36
+ "platform_id": "pc"
37
+ },
38
+ Platform.ANDROID: {
39
+ "client_id": "1924:56128:6.0.6a:android:googleplay",
40
+ "device_model": "SM-S931B", # Samsung Galaxy S23 Ultra
41
+ "device_resolution": "2340x1080",
42
+ "device_country": "FR",
43
+ "device_language": "en",
44
+ "user_agent": "MC5-Android-Client/1.0.16",
45
+ "platform_id": "android"
46
+ }
47
+ }
48
+ return configs.get(self.platform, configs[Platform.PC])
49
+
50
+ def get_client_id(self) -> str:
51
+ """Get platform-specific client ID."""
52
+ return self._config["client_id"]
53
+
54
+ def get_device_info(self) -> Dict[str, str]:
55
+ """Get platform-specific device information."""
56
+ return {
57
+ "device_model": self._config["device_model"],
58
+ "device_resolution": self._config["device_resolution"],
59
+ "device_country": self._config["device_country"],
60
+ "device_language": self._config["device_language"]
61
+ }
62
+
63
+ def get_user_agent(self) -> str:
64
+ """Get platform-specific user agent."""
65
+ return self._config["user_agent"]
66
+
67
+ def get_platform_id(self) -> str:
68
+ """Get platform identifier."""
69
+ return self._config["platform_id"]
70
+
71
+ def generate_device_id(self) -> str:
72
+ """Generate a platform-appropriate device ID."""
73
+ if self.platform == Platform.PC:
74
+ # PC: Generate a 16-digit numeric device ID
75
+ return ''.join(random.choices(string.digits, k=16))
76
+ else:
77
+ # Android: Generate a longer device ID (like Android device IDs)
78
+ return ''.join(random.choices(string.digits, k=19))
79
+
80
+ def generate_android_credential(self) -> str:
81
+ """Generate Android-specific anonymous credential."""
82
+ # Android anonymous credential format: android_v2_ANMP.GloftM5HM_<encoded_data>
83
+ base_data = f"android_v2_ANMP.GloftM5HM_{random.randint(1000000000, 9999999999)}"
84
+ # Simple encoding simulation (in real implementation, this would be proper base64)
85
+ encoded = base_data.replace("ANMP", "QU5NUA==").replace("GloftM5HM", "R2xvZnRNNUhN")
86
+ return encoded
87
+
88
+ def get_platform_config(platform: Platform = Platform.PC) -> PlatformConfig:
89
+ """Get platform configuration."""
90
+ return PlatformConfig(platform)
91
+
92
+ def detect_platform_from_client_id(client_id: str) -> Platform:
93
+ """Detect platform from client ID."""
94
+ if "android" in client_id.lower():
95
+ return Platform.ANDROID
96
+ elif "pc" in client_id.lower() or "steam" in client_id.lower():
97
+ return Platform.PC
98
+ else:
99
+ return Platform.PC # Default to PC
100
+
101
+ def get_android_anonymous_credential() -> str:
102
+ """Generate Android anonymous credential."""
103
+ config = get_platform_config(Platform.ANDROID)
104
+ return config.generate_android_credential()
105
+
106
+ def get_pc_anonymous_credential() -> str:
107
+ """Generate PC anonymous credential."""
108
+ return f"win8_v2_{random.randint(100000000, 999999999)}_{random.choices(string.ascii_letters + string.digits, k=20)}"