Skip to content

Commit 3089e4f

Browse files
🚀 feat(client): implement DNS records and file moving features
- Added DNSRecord import to client. - Implemented all_apps_status method to return running apps status. - Added move_app_file method to handle file moving. - Introduced dns_records method to get DNS records.
1 parent aae6dda commit 3089e4f

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

squarecloud/client.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
Backup,
1414
BackupInfo,
1515
DeployData,
16+
DNSRecord,
1617
DomainAnalytics,
1718
FileInfo,
1819
LogsData,
20+
ResumedStatus,
1921
StatusData,
2022
UploadData,
2123
UserData,
@@ -740,8 +742,33 @@ async def domain_analytics(
740742
return DomainAnalytics(**response.response)
741743

742744
@_notify_listener(Endpoint.all_backups())
743-
async def all_app_backups(self, app_id: str, **_kwargs):
745+
async def all_app_backups(
746+
self, app_id: str, **_kwargs
747+
) -> list[BackupInfo]:
744748
response: Response = await self._http.get_all_app_backups(
745749
app_id=app_id
746750
)
747751
return [BackupInfo(**backup_data) for backup_data in response.response]
752+
753+
@_notify_listener(Endpoint.all_apps_status())
754+
async def all_apps_status(self, **_kwargs) -> list[ResumedStatus]:
755+
response: Response = await self._http.all_apps_status()
756+
all_status = []
757+
for status in response.response:
758+
if status['running'] is True:
759+
all_status.append(ResumedStatus(**status))
760+
return all_status
761+
762+
@_notify_listener(Endpoint.move_file())
763+
async def move_app_file(
764+
self, app_id: str, origin: str, dest: str, **_kwargs
765+
) -> Response:
766+
response: Response = await self._http.move_app_file(
767+
app_id=app_id, origin=origin, dest=dest
768+
)
769+
return response
770+
771+
@_notify_listener(Endpoint.dns_records())
772+
async def dns_records(self, app_id: str) -> list[DNSRecord]:
773+
response: Response = await self._http.dns_records(app_id)
774+
return [DNSRecord(**data) for data in response.response]

0 commit comments

Comments
 (0)