squarecloud-api 3.6.2__tar.gz → 3.7.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.
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/PKG-INFO +3 -2
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/pyproject.toml +3 -2
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/__init__.py +1 -1
- squarecloud_api-3.7.1/squarecloud/_internal/constants.py +3 -0
- squarecloud_api-3.7.1/squarecloud/_internal/decorators.py +12 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/app.py +9 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/client.py +23 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/data.py +3 -2
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/http/http_client.py +1 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/listeners/__init__.py +3 -2
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/listeners/capture_listener.py +2 -2
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/listeners/request_listener.py +4 -4
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/utils.py +3 -0
- squarecloud_api-3.6.2/squarecloud/teste_foda.py +0 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/LICENSE +0 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/README.md +0 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/errors.py +0 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/file.py +0 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/http/__init__.py +0 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/http/endpoints.py +0 -0
- {squarecloud_api-3.6.2 → squarecloud_api-3.7.1}/squarecloud/logging.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: squarecloud-api
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.7.1
|
|
4
4
|
Summary: SquareCloud API wrapper
|
|
5
5
|
Home-page: https://github.com/squarecloudofc/wrapper-api-py
|
|
6
6
|
License: MIT
|
|
@@ -14,9 +14,10 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Provides-Extra: pydantic
|
|
17
|
-
Requires-Dist: aiohttp (==3.
|
|
17
|
+
Requires-Dist: aiohttp (==3.10.2)
|
|
18
18
|
Requires-Dist: pydantic (>=2.8.2,<3.0.0) ; extra == "pydantic"
|
|
19
19
|
Requires-Dist: taskipy (>=1.13.0,<2.0.0)
|
|
20
|
+
Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
|
|
20
21
|
Project-URL: Documentation, https://docs.squarecloud.app/sdks/py
|
|
21
22
|
Project-URL: Repository, https://github.com/squarecloudofc/wrapper-api-py
|
|
22
23
|
Description-Content-Type: text/markdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = 'squarecloud-api'
|
|
3
|
-
version = '3.
|
|
3
|
+
version = '3.7.1'
|
|
4
4
|
description = 'SquareCloud API wrapper'
|
|
5
5
|
authors = ['Robert Nogueira <robertlucasnogueira@gmail.com>']
|
|
6
6
|
repository = 'https://github.com/squarecloudofc/wrapper-api-py'
|
|
@@ -11,9 +11,10 @@ packages = [{ include = 'squarecloud' }]
|
|
|
11
11
|
|
|
12
12
|
[tool.poetry.dependencies]
|
|
13
13
|
python = '^3.9'
|
|
14
|
-
aiohttp = "3.
|
|
14
|
+
aiohttp = "3.10.2"
|
|
15
15
|
taskipy = "^1.13.0"
|
|
16
16
|
pydantic = {version = "^2.8.2", optional = true}
|
|
17
|
+
typing-extensions = "^4.12.2"
|
|
17
18
|
|
|
18
19
|
[tool.poetry.extras]
|
|
19
20
|
pydantic = ["pydantic"]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from .constants import USING_PYDANTIC
|
|
2
|
+
|
|
3
|
+
if USING_PYDANTIC:
|
|
4
|
+
from pydantic import ConfigDict, validate_call
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def validate(func: callable) -> callable:
|
|
8
|
+
if USING_PYDANTIC:
|
|
9
|
+
return validate_call(
|
|
10
|
+
func, config=ConfigDict(arbitrary_types_allowed=True)
|
|
11
|
+
)
|
|
12
|
+
return func
|
|
@@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, Any, Callable
|
|
|
6
6
|
|
|
7
7
|
from squarecloud import errors
|
|
8
8
|
|
|
9
|
+
from ._internal.decorators import validate
|
|
9
10
|
from .data import (
|
|
10
11
|
AppData,
|
|
11
12
|
Backup,
|
|
@@ -526,6 +527,7 @@ class Application(CaptureListenerManager):
|
|
|
526
527
|
)
|
|
527
528
|
return response
|
|
528
529
|
|
|
530
|
+
@validate
|
|
529
531
|
async def commit(self, file: File) -> Response:
|
|
530
532
|
"""
|
|
531
533
|
The commit function is used to commit the application.
|
|
@@ -541,6 +543,7 @@ class Application(CaptureListenerManager):
|
|
|
541
543
|
)
|
|
542
544
|
return response
|
|
543
545
|
|
|
546
|
+
@validate
|
|
544
547
|
async def files_list(self, path: str) -> list[FileInfo]:
|
|
545
548
|
"""
|
|
546
549
|
The files_list function returns a list of files and folders in the
|
|
@@ -558,6 +561,7 @@ class Application(CaptureListenerManager):
|
|
|
558
561
|
)
|
|
559
562
|
return response
|
|
560
563
|
|
|
564
|
+
@validate
|
|
561
565
|
async def read_file(self, path: str) -> BytesIO:
|
|
562
566
|
"""
|
|
563
567
|
The read_file function reads the contents of a file from an app.
|
|
@@ -572,6 +576,7 @@ class Application(CaptureListenerManager):
|
|
|
572
576
|
)
|
|
573
577
|
return response
|
|
574
578
|
|
|
579
|
+
@validate
|
|
575
580
|
async def create_file(self, file: File, path: str) -> Response:
|
|
576
581
|
|
|
577
582
|
"""
|
|
@@ -591,6 +596,7 @@ class Application(CaptureListenerManager):
|
|
|
591
596
|
)
|
|
592
597
|
return response
|
|
593
598
|
|
|
599
|
+
@validate
|
|
594
600
|
async def delete_file(self, path: str) -> Response:
|
|
595
601
|
"""
|
|
596
602
|
The delete_file function deletes a file from the app.
|
|
@@ -620,6 +626,7 @@ class Application(CaptureListenerManager):
|
|
|
620
626
|
)
|
|
621
627
|
return response
|
|
622
628
|
|
|
629
|
+
@validate
|
|
623
630
|
async def github_integration(self, access_token: str) -> str:
|
|
624
631
|
"""
|
|
625
632
|
The create_github_integration function returns a webhook to integrate
|
|
@@ -642,6 +649,7 @@ class Application(CaptureListenerManager):
|
|
|
642
649
|
)
|
|
643
650
|
return analytics
|
|
644
651
|
|
|
652
|
+
@validate
|
|
645
653
|
async def set_custom_domain(self, custom_domain: str):
|
|
646
654
|
response: Response = await self.client.set_custom_domain(
|
|
647
655
|
self.id, custom_domain, avoid_listener=True
|
|
@@ -652,6 +660,7 @@ class Application(CaptureListenerManager):
|
|
|
652
660
|
backups: list[BackupInfo] = await self.client.all_app_backups(self.id)
|
|
653
661
|
return backups
|
|
654
662
|
|
|
663
|
+
@validate
|
|
655
664
|
async def move_file(self, origin: str, dest: str):
|
|
656
665
|
return await self.client.move_app_file(self.id, origin, dest)
|
|
657
666
|
|
|
@@ -7,6 +7,7 @@ from typing import Any, Callable, Literal, ParamSpec, TextIO, TypeVar
|
|
|
7
7
|
|
|
8
8
|
from typing_extensions import deprecated
|
|
9
9
|
|
|
10
|
+
from ._internal.decorators import validate
|
|
10
11
|
from .app import Application
|
|
11
12
|
from .data import (
|
|
12
13
|
AppData,
|
|
@@ -253,6 +254,7 @@ class Client(RequestListenerManager):
|
|
|
253
254
|
|
|
254
255
|
return logs_data
|
|
255
256
|
|
|
257
|
+
@validate
|
|
256
258
|
@_notify_listener(Endpoint.app_status())
|
|
257
259
|
async def app_status(self, app_id: str, **_kwargs) -> StatusData:
|
|
258
260
|
"""
|
|
@@ -274,6 +276,7 @@ class Client(RequestListenerManager):
|
|
|
274
276
|
payload: dict[str, Any] = response.response
|
|
275
277
|
return StatusData(**payload)
|
|
276
278
|
|
|
279
|
+
@validate
|
|
277
280
|
@_notify_listener(Endpoint.start())
|
|
278
281
|
async def start_app(self, app_id: str, **_kwargs) -> Response:
|
|
279
282
|
"""
|
|
@@ -293,6 +296,7 @@ class Client(RequestListenerManager):
|
|
|
293
296
|
"""
|
|
294
297
|
return await self._http.start_application(app_id)
|
|
295
298
|
|
|
299
|
+
@validate
|
|
296
300
|
@_notify_listener(Endpoint.stop())
|
|
297
301
|
async def stop_app(self, app_id: str, **_kwargs) -> Response:
|
|
298
302
|
"""
|
|
@@ -312,6 +316,7 @@ class Client(RequestListenerManager):
|
|
|
312
316
|
"""
|
|
313
317
|
return await self._http.stop_application(app_id)
|
|
314
318
|
|
|
319
|
+
@validate
|
|
315
320
|
@_notify_listener(Endpoint.restart())
|
|
316
321
|
async def restart_app(self, app_id: str, **_kwargs) -> Response:
|
|
317
322
|
"""
|
|
@@ -331,6 +336,7 @@ class Client(RequestListenerManager):
|
|
|
331
336
|
"""
|
|
332
337
|
return await self._http.restart_application(app_id)
|
|
333
338
|
|
|
339
|
+
@validate
|
|
334
340
|
@_notify_listener(Endpoint.backup())
|
|
335
341
|
async def backup(self, app_id: str, **_kwargs) -> Backup:
|
|
336
342
|
"""
|
|
@@ -354,6 +360,7 @@ class Client(RequestListenerManager):
|
|
|
354
360
|
|
|
355
361
|
# async def app_backups(self) -> list[BackupInfo]:
|
|
356
362
|
|
|
363
|
+
@validate
|
|
357
364
|
@_notify_listener(Endpoint.delete_app())
|
|
358
365
|
async def delete_app(self, app_id: str, **_kwargs) -> Response:
|
|
359
366
|
"""
|
|
@@ -373,6 +380,7 @@ class Client(RequestListenerManager):
|
|
|
373
380
|
"""
|
|
374
381
|
return await self._http.delete_application(app_id)
|
|
375
382
|
|
|
383
|
+
@validate
|
|
376
384
|
@_notify_listener(Endpoint.commit())
|
|
377
385
|
async def commit(self, app_id: str, file: File, **_kwargs) -> Response:
|
|
378
386
|
"""
|
|
@@ -393,6 +401,7 @@ class Client(RequestListenerManager):
|
|
|
393
401
|
"""
|
|
394
402
|
return await self._http.commit(app_id, file)
|
|
395
403
|
|
|
404
|
+
@validate
|
|
396
405
|
@_notify_listener(Endpoint.user())
|
|
397
406
|
async def app(self, app_id: str, **_kwargs) -> Application:
|
|
398
407
|
"""
|
|
@@ -454,6 +463,7 @@ class Client(RequestListenerManager):
|
|
|
454
463
|
apps.append(Application(client=self, http=self._http, **data))
|
|
455
464
|
return apps
|
|
456
465
|
|
|
466
|
+
@validate
|
|
457
467
|
@_notify_listener(Endpoint.upload())
|
|
458
468
|
async def upload_app(self, file: File, **_kwargs) -> UploadData:
|
|
459
469
|
"""
|
|
@@ -508,6 +518,7 @@ class Client(RequestListenerManager):
|
|
|
508
518
|
payload: dict[str, Any] = response.response
|
|
509
519
|
return UploadData(**payload)
|
|
510
520
|
|
|
521
|
+
@validate
|
|
511
522
|
@_notify_listener(Endpoint.files_list())
|
|
512
523
|
async def app_files_list(
|
|
513
524
|
self, app_id: str, path: str, **_kwargs
|
|
@@ -538,6 +549,7 @@ class Client(RequestListenerManager):
|
|
|
538
549
|
for data in response.response
|
|
539
550
|
]
|
|
540
551
|
|
|
552
|
+
@validate
|
|
541
553
|
@_notify_listener(Endpoint.files_read())
|
|
542
554
|
async def read_app_file(
|
|
543
555
|
self, app_id: str, path: str, **_kwargs
|
|
@@ -563,6 +575,7 @@ class Client(RequestListenerManager):
|
|
|
563
575
|
if response.response:
|
|
564
576
|
return BytesIO(bytes(response.response.get('data')))
|
|
565
577
|
|
|
578
|
+
@validate
|
|
566
579
|
@_notify_listener(Endpoint.files_create())
|
|
567
580
|
async def create_app_file(
|
|
568
581
|
self, app_id: str, file: File, path: str, **_kwargs
|
|
@@ -597,6 +610,7 @@ class Client(RequestListenerManager):
|
|
|
597
610
|
|
|
598
611
|
return response
|
|
599
612
|
|
|
613
|
+
@validate
|
|
600
614
|
@_notify_listener(Endpoint.files_delete())
|
|
601
615
|
async def delete_app_file(
|
|
602
616
|
self, app_id: str, path: str, **_kwargs
|
|
@@ -620,6 +634,7 @@ class Client(RequestListenerManager):
|
|
|
620
634
|
"""
|
|
621
635
|
return await self._http.file_delete(app_id, path)
|
|
622
636
|
|
|
637
|
+
@validate
|
|
623
638
|
@_notify_listener(Endpoint.app_data())
|
|
624
639
|
async def app_data(self, app_id: str, **_kwargs) -> AppData:
|
|
625
640
|
"""
|
|
@@ -640,6 +655,7 @@ class Client(RequestListenerManager):
|
|
|
640
655
|
response: Response = await self._http.get_app_data(app_id)
|
|
641
656
|
return AppData(**response.response)
|
|
642
657
|
|
|
658
|
+
@validate
|
|
643
659
|
@_notify_listener(Endpoint.last_deploys())
|
|
644
660
|
async def last_deploys(
|
|
645
661
|
self, app_id: str, **_kwargs
|
|
@@ -664,6 +680,7 @@ class Client(RequestListenerManager):
|
|
|
664
680
|
data = response.response
|
|
665
681
|
return [[DeployData(**deploy) for deploy in _] for _ in data]
|
|
666
682
|
|
|
683
|
+
@validate
|
|
667
684
|
@_notify_listener(Endpoint.github_integration())
|
|
668
685
|
async def github_integration(
|
|
669
686
|
self, app_id: str, access_token: str, **_kwargs
|
|
@@ -692,6 +709,7 @@ class Client(RequestListenerManager):
|
|
|
692
709
|
data = response.response
|
|
693
710
|
return data.get('webhook')
|
|
694
711
|
|
|
712
|
+
@validate
|
|
695
713
|
@_notify_listener(Endpoint.custom_domain())
|
|
696
714
|
async def set_custom_domain(
|
|
697
715
|
self, app_id: str, custom_domain: str, **_kwargs
|
|
@@ -717,6 +735,7 @@ class Client(RequestListenerManager):
|
|
|
717
735
|
app_id=app_id, custom_domain=custom_domain
|
|
718
736
|
)
|
|
719
737
|
|
|
738
|
+
@validate
|
|
720
739
|
@_notify_listener(Endpoint.domain_analytics())
|
|
721
740
|
async def domain_analytics(
|
|
722
741
|
self, app_id: str, **_kwargs
|
|
@@ -742,6 +761,7 @@ class Client(RequestListenerManager):
|
|
|
742
761
|
|
|
743
762
|
return DomainAnalytics(**response.response)
|
|
744
763
|
|
|
764
|
+
@validate
|
|
745
765
|
@_notify_listener(Endpoint.all_backups())
|
|
746
766
|
async def all_app_backups(
|
|
747
767
|
self, app_id: str, **_kwargs
|
|
@@ -760,6 +780,7 @@ class Client(RequestListenerManager):
|
|
|
760
780
|
all_status.append(ResumedStatus(**status))
|
|
761
781
|
return all_status
|
|
762
782
|
|
|
783
|
+
@validate
|
|
763
784
|
@_notify_listener(Endpoint.move_file())
|
|
764
785
|
async def move_app_file(
|
|
765
786
|
self, app_id: str, origin: str, dest: str, **_kwargs
|
|
@@ -769,11 +790,13 @@ class Client(RequestListenerManager):
|
|
|
769
790
|
)
|
|
770
791
|
return response
|
|
771
792
|
|
|
793
|
+
@validate
|
|
772
794
|
@_notify_listener(Endpoint.dns_records())
|
|
773
795
|
async def dns_records(self, app_id: str) -> list[DNSRecord]:
|
|
774
796
|
response: Response = await self._http.dns_records(app_id)
|
|
775
797
|
return [DNSRecord(**data) for data in response.response]
|
|
776
798
|
|
|
799
|
+
@validate
|
|
777
800
|
@_notify_listener(Endpoint.current_integration())
|
|
778
801
|
async def current_app_integration(self, app_id: str) -> str | None:
|
|
779
802
|
response: Response = await self._http.get_app_current_integration(
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from datetime import datetime
|
|
4
|
-
from importlib.util import find_spec
|
|
5
4
|
from typing import Any, Dict, Literal, Optional
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
from ._internal.constants import USING_PYDANTIC
|
|
7
|
+
|
|
8
|
+
if USING_PYDANTIC:
|
|
8
9
|
from pydantic.dataclasses import dataclass
|
|
9
10
|
else:
|
|
10
11
|
from dataclasses import dataclass
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
import types
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from importlib.util import find_spec
|
|
5
4
|
from types import MappingProxyType
|
|
6
5
|
from typing import TYPE_CHECKING, Any, Callable, Optional, Type, Union
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
from .._internal.constants import USING_PYDANTIC
|
|
8
|
+
|
|
9
|
+
if USING_PYDANTIC:
|
|
9
10
|
import pydantic
|
|
10
11
|
from pydantic import BaseModel
|
|
11
12
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
import logging
|
|
3
3
|
import types
|
|
4
|
-
from importlib.util import find_spec
|
|
5
4
|
from typing import Any, Union
|
|
6
5
|
|
|
7
6
|
from .. import data, errors
|
|
7
|
+
from .._internal.constants import USING_PYDANTIC
|
|
8
8
|
from ..http import Endpoint
|
|
9
9
|
from . import Listener, ListenerManager
|
|
10
10
|
|
|
11
|
-
if
|
|
11
|
+
if USING_PYDANTIC:
|
|
12
12
|
import pydantic
|
|
13
13
|
|
|
14
14
|
ListenerDataTypes = Union[
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
import logging
|
|
3
3
|
import types
|
|
4
|
-
from importlib.util import find_spec
|
|
5
4
|
from typing import Any
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
from .._internal.constants import USING_PYDANTIC
|
|
7
|
+
|
|
8
|
+
if USING_PYDANTIC:
|
|
8
9
|
import pydantic
|
|
9
10
|
|
|
10
11
|
from ..http import Endpoint, Response
|
|
@@ -39,7 +40,6 @@ class RequestListenerManager(ListenerManager):
|
|
|
39
40
|
:param response: Response: Get the response from the endpoint
|
|
40
41
|
:return: The result of the call function
|
|
41
42
|
"""
|
|
42
|
-
global using_pydantic
|
|
43
43
|
|
|
44
44
|
def filter_annotations(annotations: list[Any]) -> Any:
|
|
45
45
|
for item in annotations:
|
|
@@ -65,7 +65,7 @@ class RequestListenerManager(ListenerManager):
|
|
|
65
65
|
call_extra_param is not None
|
|
66
66
|
and annotation is not None
|
|
67
67
|
and annotation != call_extra_param.empty
|
|
68
|
-
and
|
|
68
|
+
and USING_PYDANTIC
|
|
69
69
|
):
|
|
70
70
|
annotation: Any = call_extra_param.annotation
|
|
71
71
|
cast_result = self.cast_to_pydantic_model(annotation, extra)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from typing import Any, Literal
|
|
2
2
|
|
|
3
|
+
from squarecloud._internal.decorators import validate
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
class ConfigFile:
|
|
5
7
|
"""
|
|
@@ -8,6 +10,7 @@ class ConfigFile:
|
|
|
8
10
|
https://docs.squarecloud.app/articles/how-to-create-your-squarecloud-configuration-file
|
|
9
11
|
"""
|
|
10
12
|
|
|
13
|
+
@validate
|
|
11
14
|
def __init__(
|
|
12
15
|
self,
|
|
13
16
|
display_name: str,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|