Skip to content

Commit 26a43fc

Browse files
authored
Merge pull request #16 from Jhonatan-Jeferson/main
New addition, fixes, deprecations and adding docstrings
2 parents 4266c91 + 06a8c4f commit 26a43fc

File tree

19 files changed

+560
-151
lines changed

19 files changed

+560
-151
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
async def main():
8+
app = await client.app("your_app_id")
9+
keys = [] # The keys you want to delete
10+
result = await app.delete_envs(keys) # Deletes the specified environment variables
11+
print("Remaining env variables: ", result)
12+
13+
asyncio.run(main())
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
8+
async def main():
9+
keys = [] # The keys you want to delete
10+
result = await client.delete_app_envs("app_id", keys) # Deletes the specified environment variables
11+
print("Remaining env variables: ", result)
12+
13+
asyncio.run(main())

examples/env/get_env/with_app.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
8+
async def main():
9+
app = await client.app("your_app_id")
10+
envs = await app.get_envs()
11+
print("App envs: ", envs)
12+
13+
asyncio.run(main())
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
8+
async def main():
9+
envs = await client.get_app_envs("app_id")
10+
print("App envs: ", envs)
11+
12+
asyncio.run(main())
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
8+
async def main():
9+
app = await client.app("your_app_id")
10+
envs = {"KEY": "VALUE"} # The new environment variables
11+
result = await app.overwrite_env(envs) # Overwrites all environment variables and sets only the new ones
12+
print("Overwrite envs result: ", result)
13+
14+
asyncio.run(main())
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
8+
async def main():
9+
envs = {"ONLY_THIS": "present"} # The new environment variables
10+
result = await client.overwrite_app_envs("app_id", envs) # Overwrites all environment variables and sets only the new ones
11+
print("Overwrite envs result:", result)
12+
13+
asyncio.run(main())

examples/env/set_env/with_app.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
8+
async def main():
9+
envs = {"KEY": "VALUE"} # The environment variables you want to set
10+
app = await client.app("your_app_id")
11+
result = await app.set_envs(envs) # Sets or updates the specified environment variables
12+
print("Set envs result:", result)
13+
14+
asyncio.run(main())
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import asyncio
2+
3+
from squarecloud import Client
4+
5+
client = Client(api_key="your_api_key")
6+
7+
8+
async def main():
9+
envs = {"KEY": "VALUE"} # The environment variables you want to set
10+
result = await client.set_app_envs("app_id", envs) # Sets or updates the specified environment variables
11+
print("Set envs result:", result)
12+
13+
asyncio.run(main())

examples/backup/with_application.py renamed to examples/snapshots/with_application.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
async def example() -> None:
99
app = await client.app('application_id')
10-
backup = await app.backup()
11-
print(backup.url) # https://squarecloud.app/dashboard/backup/f.zip
12-
10+
snapshot = await app.snapshot()
11+
print(snapshot.url) # https://squarecloud.app/dashboard/backup/f.zip
1312

1413
asyncio.run(example())

examples/backup/with_client.py renamed to examples/snapshots/with_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77

88
async def example() -> None:
9-
backup = await client.backup('application_id')
10-
print(backup.url) # https://squarecloud.app/dashboard/backup/f.zip
9+
snapshot = await client.snapshot('application_id')
10+
print(snapshot.url) # https://squarecloud.app/dashboard/backup/f.zip
1111

1212

1313
asyncio.run(example())

0 commit comments

Comments
 (0)