Skip to content

Commit 1a18964

Browse files
authored
Merge pull request #18 from Jhonatan-Jeferson/main
Updating deps, adding the recent created_at field on AppData and CD workflow
2 parents a28b1f7 + 44693cf commit 1a18964

13 files changed

Lines changed: 2162 additions & 1401 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Publish Package"
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
jobs:
7+
publish:
8+
name: "Publish to PyPI"
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: '3.12'
16+
17+
- name: Install Pipx & Poetry
18+
run: |
19+
python3 -m pip install --upgrade pip
20+
pip install pipx
21+
pipx install poetry
22+
23+
- name: Publish Package
24+
env:
25+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
26+
run: |
27+
poetry config pypi-token.pypi $PYPI_API_TOKEN
28+
poetry publish --build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/__pycache__
2+
**/.env

poetry.lock

Lines changed: 2074 additions & 1366 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = 'squarecloud-api'
3-
version = '3.8.0'
3+
version = '3.8.1'
44
description = 'SquareCloud API wrapper'
55
authors = ['Robert Nogueira <robertlucasnogueira@gmail.com>']
66
repository = 'https://github.com/squarecloudofc/wrapper-api-py'
@@ -12,31 +12,31 @@ packages = [{ include = "squarecloud" }]
1212

1313
[tool.poetry.dependencies]
1414
python = '^3.13'
15-
typing-extensions = "^4.12.2"
16-
aiohttp = "^3.11.14"
17-
pydantic = "2.9.2"
15+
typing-extensions = "^4.15.0"
16+
aiohttp = "^3.13.2"
17+
pydantic = "^2.12.5"
1818

1919
[tool.poetry.extras]
2020
pydantic = ["pydantic"]
2121

2222
[tool.poetry.group.dev.dependencies]
23-
isort = "^6.0.1"
24-
pre-commit = "^4.2.0"
25-
pytest = "^8.3.5"
26-
pytest-asyncio = "^0.26.0"
23+
isort = "^7.0.0"
24+
pre-commit = "^4.5.0"
25+
pytest = "^9.0.2"
26+
pytest-asyncio = "^1.3.0"
2727
pytest-cov = "^6.0.0"
28-
pytest-rerunfailures = "^15.0"
29-
ruff = "^0.11.2"
28+
pytest-rerunfailures = "^16.1"
29+
ruff = "^0.14.9"
3030
taskipy = "^1.14.1"
31-
bandit = {extras = ["toml"], version = "^1.8.3"}
31+
bandit = {extras = ["toml"], version = "^1.9.2"}
3232
cz-conventional-gitmoji = "^0.7.0"
33-
memory-profiler = '^0.61.0'
34-
requests = '^2.31.0'
35-
python-dotenv = "^1.0.1"
36-
safety = "^3.3.1"
33+
memory-profiler = "^0.61.0"
34+
requests = "^2.32.5"
35+
python-dotenv = "^1.2.1"
36+
safety = "^3.7.0"
3737
vulture = "^2.14"
38-
mypy-extensions = "^1.0.0"
39-
commitizen = "^4.5.1"
38+
mypy-extensions = "^1.1.0"
39+
commitizen = "^4.10.1"
4040

4141
[build-system]
4242
requires = ['poetry-core']

squarecloud/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
from .client import Client
66
from .data import (
77
AppData,
8-
Snapshot,
9-
SnapshotInfo,
108
DeployData,
119
DNSRecord,
1210
DomainAnalytics,
1311
FileInfo,
1412
LogsData,
1513
PlanData,
1614
ResumedStatus,
15+
Snapshot,
16+
SnapshotInfo,
1717
StatusData,
1818
UploadData,
1919
UserData,
@@ -45,4 +45,4 @@
4545
'utils',
4646
]
4747

48-
__version__ = '3.7.4'
48+
__version__ = '3.8.1'

squarecloud/app.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from datetime import datetime
34
from functools import wraps
45
from io import BytesIO
56
from typing import TYPE_CHECKING, Any, Callable, Coroutine, TypeVar
@@ -11,13 +12,13 @@
1112
from ._internal.decorators import validate
1213
from .data import (
1314
AppData,
14-
Snapshot,
15-
SnapshotInfo,
1615
DeployData,
1716
DNSRecord,
1817
DomainAnalytics,
1918
FileInfo,
2019
LogsData,
20+
Snapshot,
21+
SnapshotInfo,
2122
StatusData,
2223
)
2324
from .file import File
@@ -185,6 +186,7 @@ class Application(CaptureListenerManager):
185186
'_lang',
186187
'_cluster',
187188
'always_avoid_listeners',
189+
'_created_at'
188190
]
189191

190192
def __init__(
@@ -196,9 +198,10 @@ def __init__(
196198
ram: int,
197199
lang: str,
198200
cluster: str,
201+
created_at: datetime,
199202
domain: str | None,
200203
custom: str | None,
201-
desc: str | None = None,
204+
desc: str | None = None
202205
) -> None:
203206
"""
204207
The `__init__` method is called when the class is instantiated.
@@ -234,6 +237,8 @@ def __init__(
234237
self._listener: CaptureListenerManager = CaptureListenerManager()
235238
self.cache: AppCache = AppCache()
236239
self.always_avoid_listeners: bool = False
240+
self._created_at: datetime = created_at
241+
237242
super().__init__()
238243

239244
def __repr__(self) -> str:
@@ -351,6 +356,17 @@ def custom(self) -> str | None:
351356
"""
352357
return self._custom
353358

359+
@property
360+
def created_at(self) -> datetime:
361+
"""
362+
The created_at function is a property that returns the date and time
363+
when the application was created.
364+
365+
:return: The created_at attribute of the application
366+
:rtype: datetime
367+
"""
368+
return self._created_at
369+
354370
@staticmethod
355371
def _notify_listener(
356372
endpoint: Endpoint,

squarecloud/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
from .app import Application
1313
from .data import (
1414
AppData,
15-
Snapshot,
16-
SnapshotInfo,
1715
DeployData,
1816
DNSRecord,
1917
DomainAnalytics,
2018
FileInfo,
2119
LogsData,
2220
ResumedStatus,
21+
Snapshot,
22+
SnapshotInfo,
2323
StatusData,
2424
UploadData,
2525
UserData,
@@ -401,7 +401,7 @@ async def app(self, app_id: str, **_kwargs) -> Application:
401401
return Application(client=self, http=self._http, **app_data)
402402

403403
# @_notify_listener(Endpoint.user())
404-
async def all_apps(self, **_kwargs) -> list[int]:
404+
async def all_apps(self, **_kwargs) -> list[Application]:
405405
"""
406406
The all_apps method returns a list of all applications that the user
407407
has access to.
@@ -581,7 +581,7 @@ async def delete_app_file(
581581
"""
582582
The delete_app_file method deletes a file in the specified directory.
583583
584-
:param app_id: Specify the application byd id
584+
:param app_id: Specify the application by id
585585
:param path: Specify the directory where the file should be
586586
deleted
587587
:param _kwargs: Keyword arguments

squarecloud/data.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,16 @@ class AppData(BaseDataClass):
9898
:ivar cluster: The cluster that the app is hosted on
9999
:ivar ram: The amount of RAM that application is using
100100
:ivar language The programming language of the app.:
101+
:ivar domain: The domain of the application
102+
:ivar custom: The custom domain of the application
103+
:ivar desc: The description of the application
104+
:ivar created_at: The date when the application was created
101105
102106
:type id: str
103107
:type name: str
104108
:type cluster: str
105109
:type ram: confloat(ge=0);
106-
:type lang: Language
110+
:type lang: str | None
107111
:type domain: str | None = None
108112
:type custom: str | None = None
109113
:type desc: str | None = None
@@ -113,8 +117,9 @@ class AppData(BaseDataClass):
113117
name: str
114118
cluster: str
115119
ram: float
116-
lang: str | None
117120
cluster: str
121+
created_at: datetime
122+
lang: str | None
118123
domain: str | None = None
119124
custom: str | None = None
120125
desc: str | None = None

squarecloud/http/http_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
InvalidMain,
1919
InvalidMemory,
2020
InvalidStart,
21+
InvalidSubdomain,
2122
InvalidVersion,
2223
MissingConfigFile,
2324
MissingDependenciesFile,
@@ -28,7 +29,6 @@
2829
NotFoundError,
2930
RequestError,
3031
TooManyRequests,
31-
InvalidSubdomain
3232
)
3333
from ..logger import logger
3434
from .endpoints import Endpoint, Router
@@ -163,7 +163,7 @@ async def request(self, route: Router, **kwargs: Any) -> Response:
163163
"""
164164
headers = {
165165
'Authorization': self.api_key,
166-
'User-Agent': 'squarecloud-sdk-py/3.7.4',
166+
'User-Agent': 'squarecloud-sdk-py/3.8.1',
167167
}
168168
extra_error_kwargs: dict[str, Any] = {}
169169

test.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
KEY=API_KEY
2+
GITHUB_ACCESS_TOKEN=GITHUB_ACCESS_TOKEN

0 commit comments

Comments
 (0)