update: generate docs examples as per latest 1.8.x source.

This commit is contained in:
Darshan
2025-06-19 18:13:27 +05:30
parent c7a3ffdb71
commit 974037ee38
6235 changed files with 96496 additions and 0 deletions
@@ -0,0 +1,22 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key
storage = Storage(client)
result = storage.create_bucket(
bucket_id = '<BUCKET_ID>',
name = '<NAME>',
permissions = ["read("any")"], # optional
file_security = False, # optional
enabled = False, # optional
maximum_file_size = 1, # optional
allowed_file_extensions = [], # optional
compression = .NONE, # optional
encryption = False, # optional
antivirus = False # optional
)
@@ -0,0 +1,17 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
from appwrite.input_file import InputFile
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.create_file(
bucket_id = '<BUCKET_ID>',
file_id = '<FILE_ID>',
file = InputFile.from_path('file.png'),
permissions = ["read("any")"] # optional
)
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key
storage = Storage(client)
result = storage.delete_bucket(
bucket_id = '<BUCKET_ID>'
)
@@ -0,0 +1,14 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.delete_file(
bucket_id = '<BUCKET_ID>',
file_id = '<FILE_ID>'
)
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key
storage = Storage(client)
result = storage.get_bucket(
bucket_id = '<BUCKET_ID>'
)
@@ -0,0 +1,15 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.get_file_download(
bucket_id = '<BUCKET_ID>',
file_id = '<FILE_ID>',
token = '<TOKEN>' # optional
)
@@ -0,0 +1,26 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.get_file_preview(
bucket_id = '<BUCKET_ID>',
file_id = '<FILE_ID>',
width = 0, # optional
height = 0, # optional
gravity = ImageGravity.CENTER, # optional
quality = -1, # optional
border_width = 0, # optional
border_color = '', # optional
border_radius = 0, # optional
opacity = 0, # optional
rotation = -360, # optional
background = '', # optional
output = ImageFormat.JPG, # optional
token = '<TOKEN>' # optional
)
@@ -0,0 +1,15 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.get_file_view(
bucket_id = '<BUCKET_ID>',
file_id = '<FILE_ID>',
token = '<TOKEN>' # optional
)
@@ -0,0 +1,14 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.get_file(
bucket_id = '<BUCKET_ID>',
file_id = '<FILE_ID>'
)
@@ -0,0 +1,14 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key
storage = Storage(client)
result = storage.list_buckets(
queries = [], # optional
search = '<SEARCH>' # optional
)
@@ -0,0 +1,15 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.list_files(
bucket_id = '<BUCKET_ID>',
queries = [], # optional
search = '<SEARCH>' # optional
)
@@ -0,0 +1,22 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key
storage = Storage(client)
result = storage.update_bucket(
bucket_id = '<BUCKET_ID>',
name = '<NAME>',
permissions = ["read("any")"], # optional
file_security = False, # optional
enabled = False, # optional
maximum_file_size = 1, # optional
allowed_file_extensions = [], # optional
compression = .NONE, # optional
encryption = False, # optional
antivirus = False # optional
)
@@ -0,0 +1,16 @@
from appwrite.client import Client
from appwrite.services.storage import Storage
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_session('') # The user session to authenticate with
storage = Storage(client)
result = storage.update_file(
bucket_id = '<BUCKET_ID>',
file_id = '<FILE_ID>',
name = '<NAME>', # optional
permissions = ["read("any")"] # optional
)