From 9777dc02546db3399f966be8f4b406ebbad52ed0 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 28 Nov 2025 19:05:10 +0000 Subject: [PATCH 1/3] feat: add method to service --- CHANGELOG.md | 4 + appwrite/client.py | 4 +- appwrite/encoders/value_class_encoder.py | 20 +- appwrite/enums/build_runtime.py | 2 + appwrite/enums/output.py | 10 + appwrite/enums/runtime.py | 2 + appwrite/enums/template_reference_type.py | 6 + appwrite/enums/theme.py | 5 + appwrite/enums/timezone.py | 422 ++++++++++++++++++ ...ployment_type.py => vcs_reference_type.py} | 2 +- appwrite/services/avatars.py | 114 +++++ appwrite/services/databases.py | 153 +++---- appwrite/services/functions.py | 34 +- appwrite/services/messaging.py | 210 +++------ appwrite/services/sites.py | 33 +- appwrite/services/storage.py | 26 +- appwrite/services/tables_db.py | 155 +++---- appwrite/services/users.py | 6 +- docs/examples/avatars/get-screenshot.md | 35 ++ .../create-relationship-attribute.md | 1 + .../update-relationship-attribute.md | 1 + docs/examples/functions/create-execution.md | 1 + .../functions/create-template-deployment.md | 4 +- .../functions/create-vcs-deployment.md | 4 +- docs/examples/functions/create.md | 4 +- .../functions/get-deployment-download.md | 1 + docs/examples/functions/update.md | 3 +- docs/examples/health/get-failed-jobs.md | 4 +- docs/examples/messaging/create-push.md | 1 + .../messaging/create-smtp-provider.md | 1 + docs/examples/messaging/update-push.md | 1 + .../messaging/update-smtp-provider.md | 1 + .../sites/create-template-deployment.md | 4 +- docs/examples/sites/create-vcs-deployment.md | 4 +- docs/examples/sites/create.md | 11 +- .../examples/sites/get-deployment-download.md | 1 + docs/examples/sites/update.md | 10 +- docs/examples/storage/create-bucket.md | 6 +- docs/examples/storage/get-file-preview.md | 2 + docs/examples/storage/update-bucket.md | 6 +- .../tablesdb/create-relationship-column.md | 1 + .../tablesdb/update-relationship-column.md | 1 + docs/examples/users/create-sha-user.md | 1 + setup.py | 4 +- 44 files changed, 901 insertions(+), 420 deletions(-) create mode 100644 appwrite/enums/output.py create mode 100644 appwrite/enums/template_reference_type.py create mode 100644 appwrite/enums/theme.py create mode 100644 appwrite/enums/timezone.py rename appwrite/enums/{vcs_deployment_type.py => vcs_reference_type.py} (72%) create mode 100644 docs/examples/avatars/get-screenshot.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 31396fa..bae5dcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 13.7.0 + +* Add `get_screenshot` method to `Avatars` service + ## 13.6.1 * Fix passing of `None` to nullable parameters diff --git a/appwrite/client.py b/appwrite/client.py index 67fef99..05d666d 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -15,11 +15,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/13.6.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/13.7.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '13.6.1', + 'x-sdk-version': '13.7.0', 'X-Appwrite-Response-Format' : '1.8.0', } diff --git a/appwrite/encoders/value_class_encoder.py b/appwrite/encoders/value_class_encoder.py index fe6dd01..cc9db59 100644 --- a/appwrite/encoders/value_class_encoder.py +++ b/appwrite/encoders/value_class_encoder.py @@ -5,11 +5,15 @@ from ..enums.browser import Browser from ..enums.credit_card import CreditCard from ..enums.flag import Flag +from ..enums.theme import Theme +from ..enums.timezone import Timezone +from ..enums.output import Output from ..enums.relationship_type import RelationshipType from ..enums.relation_mutate import RelationMutate from ..enums.index_type import IndexType from ..enums.runtime import Runtime -from ..enums.vcs_deployment_type import VCSDeploymentType +from ..enums.template_reference_type import TemplateReferenceType +from ..enums.vcs_reference_type import VCSReferenceType from ..enums.deployment_download_type import DeploymentDownloadType from ..enums.execution_method import ExecutionMethod from ..enums.name import Name @@ -54,6 +58,15 @@ def default(self, o): if isinstance(o, Flag): return o.value + if isinstance(o, Theme): + return o.value + + if isinstance(o, Timezone): + return o.value + + if isinstance(o, Output): + return o.value + if isinstance(o, RelationshipType): return o.value @@ -66,7 +79,10 @@ def default(self, o): if isinstance(o, Runtime): return o.value - if isinstance(o, VCSDeploymentType): + if isinstance(o, TemplateReferenceType): + return o.value + + if isinstance(o, VCSReferenceType): return o.value if isinstance(o, DeploymentDownloadType): diff --git a/appwrite/enums/build_runtime.py b/appwrite/enums/build_runtime.py index aded697..0b506b9 100644 --- a/appwrite/enums/build_runtime.py +++ b/appwrite/enums/build_runtime.py @@ -39,6 +39,7 @@ class BuildRuntime(Enum): DART_3_3 = "dart-3.3" DART_3_5 = "dart-3.5" DART_3_8 = "dart-3.8" + DART_3_9 = "dart-3.9" DOTNET_6_0 = "dotnet-6.0" DOTNET_7_0 = "dotnet-7.0" DOTNET_8_0 = "dotnet-8.0" @@ -66,3 +67,4 @@ class BuildRuntime(Enum): FLUTTER_3_27 = "flutter-3.27" FLUTTER_3_29 = "flutter-3.29" FLUTTER_3_32 = "flutter-3.32" + FLUTTER_3_35 = "flutter-3.35" diff --git a/appwrite/enums/output.py b/appwrite/enums/output.py new file mode 100644 index 0000000..c76e835 --- /dev/null +++ b/appwrite/enums/output.py @@ -0,0 +1,10 @@ +from enum import Enum + +class Output(Enum): + JPG = "jpg" + JPEG = "jpeg" + PNG = "png" + WEBP = "webp" + HEIC = "heic" + AVIF = "avif" + GIF = "gif" diff --git a/appwrite/enums/runtime.py b/appwrite/enums/runtime.py index b0e307a..0f0be3c 100644 --- a/appwrite/enums/runtime.py +++ b/appwrite/enums/runtime.py @@ -39,6 +39,7 @@ class Runtime(Enum): DART_3_3 = "dart-3.3" DART_3_5 = "dart-3.5" DART_3_8 = "dart-3.8" + DART_3_9 = "dart-3.9" DOTNET_6_0 = "dotnet-6.0" DOTNET_7_0 = "dotnet-7.0" DOTNET_8_0 = "dotnet-8.0" @@ -66,3 +67,4 @@ class Runtime(Enum): FLUTTER_3_27 = "flutter-3.27" FLUTTER_3_29 = "flutter-3.29" FLUTTER_3_32 = "flutter-3.32" + FLUTTER_3_35 = "flutter-3.35" diff --git a/appwrite/enums/template_reference_type.py b/appwrite/enums/template_reference_type.py new file mode 100644 index 0000000..9b0e50e --- /dev/null +++ b/appwrite/enums/template_reference_type.py @@ -0,0 +1,6 @@ +from enum import Enum + +class TemplateReferenceType(Enum): + BRANCH = "branch" + COMMIT = "commit" + TAG = "tag" diff --git a/appwrite/enums/theme.py b/appwrite/enums/theme.py new file mode 100644 index 0000000..cd30f8b --- /dev/null +++ b/appwrite/enums/theme.py @@ -0,0 +1,5 @@ +from enum import Enum + +class Theme(Enum): + LIGHT = "light" + DARK = "dark" diff --git a/appwrite/enums/timezone.py b/appwrite/enums/timezone.py new file mode 100644 index 0000000..d68d075 --- /dev/null +++ b/appwrite/enums/timezone.py @@ -0,0 +1,422 @@ +from enum import Enum + +class Timezone(Enum): + AFRICA_ABIDJAN = "africa/abidjan" + AFRICA_ACCRA = "africa/accra" + AFRICA_ADDIS_ABABA = "africa/addis_ababa" + AFRICA_ALGIERS = "africa/algiers" + AFRICA_ASMARA = "africa/asmara" + AFRICA_BAMAKO = "africa/bamako" + AFRICA_BANGUI = "africa/bangui" + AFRICA_BANJUL = "africa/banjul" + AFRICA_BISSAU = "africa/bissau" + AFRICA_BLANTYRE = "africa/blantyre" + AFRICA_BRAZZAVILLE = "africa/brazzaville" + AFRICA_BUJUMBURA = "africa/bujumbura" + AFRICA_CAIRO = "africa/cairo" + AFRICA_CASABLANCA = "africa/casablanca" + AFRICA_CEUTA = "africa/ceuta" + AFRICA_CONAKRY = "africa/conakry" + AFRICA_DAKAR = "africa/dakar" + AFRICA_DAR_ES_SALAAM = "africa/dar_es_salaam" + AFRICA_DJIBOUTI = "africa/djibouti" + AFRICA_DOUALA = "africa/douala" + AFRICA_EL_AAIUN = "africa/el_aaiun" + AFRICA_FREETOWN = "africa/freetown" + AFRICA_GABORONE = "africa/gaborone" + AFRICA_HARARE = "africa/harare" + AFRICA_JOHANNESBURG = "africa/johannesburg" + AFRICA_JUBA = "africa/juba" + AFRICA_KAMPALA = "africa/kampala" + AFRICA_KHARTOUM = "africa/khartoum" + AFRICA_KIGALI = "africa/kigali" + AFRICA_KINSHASA = "africa/kinshasa" + AFRICA_LAGOS = "africa/lagos" + AFRICA_LIBREVILLE = "africa/libreville" + AFRICA_LOME = "africa/lome" + AFRICA_LUANDA = "africa/luanda" + AFRICA_LUBUMBASHI = "africa/lubumbashi" + AFRICA_LUSAKA = "africa/lusaka" + AFRICA_MALABO = "africa/malabo" + AFRICA_MAPUTO = "africa/maputo" + AFRICA_MASERU = "africa/maseru" + AFRICA_MBABANE = "africa/mbabane" + AFRICA_MOGADISHU = "africa/mogadishu" + AFRICA_MONROVIA = "africa/monrovia" + AFRICA_NAIROBI = "africa/nairobi" + AFRICA_NDJAMENA = "africa/ndjamena" + AFRICA_NIAMEY = "africa/niamey" + AFRICA_NOUAKCHOTT = "africa/nouakchott" + AFRICA_OUAGADOUGOU = "africa/ouagadougou" + AFRICA_PORTO_NOVO = "africa/porto-novo" + AFRICA_SAO_TOME = "africa/sao_tome" + AFRICA_TRIPOLI = "africa/tripoli" + AFRICA_TUNIS = "africa/tunis" + AFRICA_WINDHOEK = "africa/windhoek" + AMERICA_ADAK = "america/adak" + AMERICA_ANCHORAGE = "america/anchorage" + AMERICA_ANGUILLA = "america/anguilla" + AMERICA_ANTIGUA = "america/antigua" + AMERICA_ARAGUAINA = "america/araguaina" + AMERICA_ARGENTINA_BUENOS_AIRES = "america/argentina/buenos_aires" + AMERICA_ARGENTINA_CATAMARCA = "america/argentina/catamarca" + AMERICA_ARGENTINA_CORDOBA = "america/argentina/cordoba" + AMERICA_ARGENTINA_JUJUY = "america/argentina/jujuy" + AMERICA_ARGENTINA_LA_RIOJA = "america/argentina/la_rioja" + AMERICA_ARGENTINA_MENDOZA = "america/argentina/mendoza" + AMERICA_ARGENTINA_RIO_GALLEGOS = "america/argentina/rio_gallegos" + AMERICA_ARGENTINA_SALTA = "america/argentina/salta" + AMERICA_ARGENTINA_SAN_JUAN = "america/argentina/san_juan" + AMERICA_ARGENTINA_SAN_LUIS = "america/argentina/san_luis" + AMERICA_ARGENTINA_TUCUMAN = "america/argentina/tucuman" + AMERICA_ARGENTINA_USHUAIA = "america/argentina/ushuaia" + AMERICA_ARUBA = "america/aruba" + AMERICA_ASUNCION = "america/asuncion" + AMERICA_ATIKOKAN = "america/atikokan" + AMERICA_BAHIA = "america/bahia" + AMERICA_BAHIA_BANDERAS = "america/bahia_banderas" + AMERICA_BARBADOS = "america/barbados" + AMERICA_BELEM = "america/belem" + AMERICA_BELIZE = "america/belize" + AMERICA_BLANC_SABLON = "america/blanc-sablon" + AMERICA_BOA_VISTA = "america/boa_vista" + AMERICA_BOGOTA = "america/bogota" + AMERICA_BOISE = "america/boise" + AMERICA_CAMBRIDGE_BAY = "america/cambridge_bay" + AMERICA_CAMPO_GRANDE = "america/campo_grande" + AMERICA_CANCUN = "america/cancun" + AMERICA_CARACAS = "america/caracas" + AMERICA_CAYENNE = "america/cayenne" + AMERICA_CAYMAN = "america/cayman" + AMERICA_CHICAGO = "america/chicago" + AMERICA_CHIHUAHUA = "america/chihuahua" + AMERICA_CIUDAD_JUAREZ = "america/ciudad_juarez" + AMERICA_COSTA_RICA = "america/costa_rica" + AMERICA_COYHAIQUE = "america/coyhaique" + AMERICA_CRESTON = "america/creston" + AMERICA_CUIABA = "america/cuiaba" + AMERICA_CURACAO = "america/curacao" + AMERICA_DANMARKSHAVN = "america/danmarkshavn" + AMERICA_DAWSON = "america/dawson" + AMERICA_DAWSON_CREEK = "america/dawson_creek" + AMERICA_DENVER = "america/denver" + AMERICA_DETROIT = "america/detroit" + AMERICA_DOMINICA = "america/dominica" + AMERICA_EDMONTON = "america/edmonton" + AMERICA_EIRUNEPE = "america/eirunepe" + AMERICA_EL_SALVADOR = "america/el_salvador" + AMERICA_FORT_NELSON = "america/fort_nelson" + AMERICA_FORTALEZA = "america/fortaleza" + AMERICA_GLACE_BAY = "america/glace_bay" + AMERICA_GOOSE_BAY = "america/goose_bay" + AMERICA_GRAND_TURK = "america/grand_turk" + AMERICA_GRENADA = "america/grenada" + AMERICA_GUADELOUPE = "america/guadeloupe" + AMERICA_GUATEMALA = "america/guatemala" + AMERICA_GUAYAQUIL = "america/guayaquil" + AMERICA_GUYANA = "america/guyana" + AMERICA_HALIFAX = "america/halifax" + AMERICA_HAVANA = "america/havana" + AMERICA_HERMOSILLO = "america/hermosillo" + AMERICA_INDIANA_INDIANAPOLIS = "america/indiana/indianapolis" + AMERICA_INDIANA_KNOX = "america/indiana/knox" + AMERICA_INDIANA_MARENGO = "america/indiana/marengo" + AMERICA_INDIANA_PETERSBURG = "america/indiana/petersburg" + AMERICA_INDIANA_TELL_CITY = "america/indiana/tell_city" + AMERICA_INDIANA_VEVAY = "america/indiana/vevay" + AMERICA_INDIANA_VINCENNES = "america/indiana/vincennes" + AMERICA_INDIANA_WINAMAC = "america/indiana/winamac" + AMERICA_INUVIK = "america/inuvik" + AMERICA_IQALUIT = "america/iqaluit" + AMERICA_JAMAICA = "america/jamaica" + AMERICA_JUNEAU = "america/juneau" + AMERICA_KENTUCKY_LOUISVILLE = "america/kentucky/louisville" + AMERICA_KENTUCKY_MONTICELLO = "america/kentucky/monticello" + AMERICA_KRALENDIJK = "america/kralendijk" + AMERICA_LA_PAZ = "america/la_paz" + AMERICA_LIMA = "america/lima" + AMERICA_LOS_ANGELES = "america/los_angeles" + AMERICA_LOWER_PRINCES = "america/lower_princes" + AMERICA_MACEIO = "america/maceio" + AMERICA_MANAGUA = "america/managua" + AMERICA_MANAUS = "america/manaus" + AMERICA_MARIGOT = "america/marigot" + AMERICA_MARTINIQUE = "america/martinique" + AMERICA_MATAMOROS = "america/matamoros" + AMERICA_MAZATLAN = "america/mazatlan" + AMERICA_MENOMINEE = "america/menominee" + AMERICA_MERIDA = "america/merida" + AMERICA_METLAKATLA = "america/metlakatla" + AMERICA_MEXICO_CITY = "america/mexico_city" + AMERICA_MIQUELON = "america/miquelon" + AMERICA_MONCTON = "america/moncton" + AMERICA_MONTERREY = "america/monterrey" + AMERICA_MONTEVIDEO = "america/montevideo" + AMERICA_MONTSERRAT = "america/montserrat" + AMERICA_NASSAU = "america/nassau" + AMERICA_NEW_YORK = "america/new_york" + AMERICA_NOME = "america/nome" + AMERICA_NORONHA = "america/noronha" + AMERICA_NORTH_DAKOTA_BEULAH = "america/north_dakota/beulah" + AMERICA_NORTH_DAKOTA_CENTER = "america/north_dakota/center" + AMERICA_NORTH_DAKOTA_NEW_SALEM = "america/north_dakota/new_salem" + AMERICA_NUUK = "america/nuuk" + AMERICA_OJINAGA = "america/ojinaga" + AMERICA_PANAMA = "america/panama" + AMERICA_PARAMARIBO = "america/paramaribo" + AMERICA_PHOENIX = "america/phoenix" + AMERICA_PORT_AU_PRINCE = "america/port-au-prince" + AMERICA_PORT_OF_SPAIN = "america/port_of_spain" + AMERICA_PORTO_VELHO = "america/porto_velho" + AMERICA_PUERTO_RICO = "america/puerto_rico" + AMERICA_PUNTA_ARENAS = "america/punta_arenas" + AMERICA_RANKIN_INLET = "america/rankin_inlet" + AMERICA_RECIFE = "america/recife" + AMERICA_REGINA = "america/regina" + AMERICA_RESOLUTE = "america/resolute" + AMERICA_RIO_BRANCO = "america/rio_branco" + AMERICA_SANTAREM = "america/santarem" + AMERICA_SANTIAGO = "america/santiago" + AMERICA_SANTO_DOMINGO = "america/santo_domingo" + AMERICA_SAO_PAULO = "america/sao_paulo" + AMERICA_SCORESBYSUND = "america/scoresbysund" + AMERICA_SITKA = "america/sitka" + AMERICA_ST_BARTHELEMY = "america/st_barthelemy" + AMERICA_ST_JOHNS = "america/st_johns" + AMERICA_ST_KITTS = "america/st_kitts" + AMERICA_ST_LUCIA = "america/st_lucia" + AMERICA_ST_THOMAS = "america/st_thomas" + AMERICA_ST_VINCENT = "america/st_vincent" + AMERICA_SWIFT_CURRENT = "america/swift_current" + AMERICA_TEGUCIGALPA = "america/tegucigalpa" + AMERICA_THULE = "america/thule" + AMERICA_TIJUANA = "america/tijuana" + AMERICA_TORONTO = "america/toronto" + AMERICA_TORTOLA = "america/tortola" + AMERICA_VANCOUVER = "america/vancouver" + AMERICA_WHITEHORSE = "america/whitehorse" + AMERICA_WINNIPEG = "america/winnipeg" + AMERICA_YAKUTAT = "america/yakutat" + ANTARCTICA_CASEY = "antarctica/casey" + ANTARCTICA_DAVIS = "antarctica/davis" + ANTARCTICA_DUMONTDURVILLE = "antarctica/dumontdurville" + ANTARCTICA_MACQUARIE = "antarctica/macquarie" + ANTARCTICA_MAWSON = "antarctica/mawson" + ANTARCTICA_MCMURDO = "antarctica/mcmurdo" + ANTARCTICA_PALMER = "antarctica/palmer" + ANTARCTICA_ROTHERA = "antarctica/rothera" + ANTARCTICA_SYOWA = "antarctica/syowa" + ANTARCTICA_TROLL = "antarctica/troll" + ANTARCTICA_VOSTOK = "antarctica/vostok" + ARCTIC_LONGYEARBYEN = "arctic/longyearbyen" + ASIA_ADEN = "asia/aden" + ASIA_ALMATY = "asia/almaty" + ASIA_AMMAN = "asia/amman" + ASIA_ANADYR = "asia/anadyr" + ASIA_AQTAU = "asia/aqtau" + ASIA_AQTOBE = "asia/aqtobe" + ASIA_ASHGABAT = "asia/ashgabat" + ASIA_ATYRAU = "asia/atyrau" + ASIA_BAGHDAD = "asia/baghdad" + ASIA_BAHRAIN = "asia/bahrain" + ASIA_BAKU = "asia/baku" + ASIA_BANGKOK = "asia/bangkok" + ASIA_BARNAUL = "asia/barnaul" + ASIA_BEIRUT = "asia/beirut" + ASIA_BISHKEK = "asia/bishkek" + ASIA_BRUNEI = "asia/brunei" + ASIA_CHITA = "asia/chita" + ASIA_COLOMBO = "asia/colombo" + ASIA_DAMASCUS = "asia/damascus" + ASIA_DHAKA = "asia/dhaka" + ASIA_DILI = "asia/dili" + ASIA_DUBAI = "asia/dubai" + ASIA_DUSHANBE = "asia/dushanbe" + ASIA_FAMAGUSTA = "asia/famagusta" + ASIA_GAZA = "asia/gaza" + ASIA_HEBRON = "asia/hebron" + ASIA_HO_CHI_MINH = "asia/ho_chi_minh" + ASIA_HONG_KONG = "asia/hong_kong" + ASIA_HOVD = "asia/hovd" + ASIA_IRKUTSK = "asia/irkutsk" + ASIA_JAKARTA = "asia/jakarta" + ASIA_JAYAPURA = "asia/jayapura" + ASIA_JERUSALEM = "asia/jerusalem" + ASIA_KABUL = "asia/kabul" + ASIA_KAMCHATKA = "asia/kamchatka" + ASIA_KARACHI = "asia/karachi" + ASIA_KATHMANDU = "asia/kathmandu" + ASIA_KHANDYGA = "asia/khandyga" + ASIA_KOLKATA = "asia/kolkata" + ASIA_KRASNOYARSK = "asia/krasnoyarsk" + ASIA_KUALA_LUMPUR = "asia/kuala_lumpur" + ASIA_KUCHING = "asia/kuching" + ASIA_KUWAIT = "asia/kuwait" + ASIA_MACAU = "asia/macau" + ASIA_MAGADAN = "asia/magadan" + ASIA_MAKASSAR = "asia/makassar" + ASIA_MANILA = "asia/manila" + ASIA_MUSCAT = "asia/muscat" + ASIA_NICOSIA = "asia/nicosia" + ASIA_NOVOKUZNETSK = "asia/novokuznetsk" + ASIA_NOVOSIBIRSK = "asia/novosibirsk" + ASIA_OMSK = "asia/omsk" + ASIA_ORAL = "asia/oral" + ASIA_PHNOM_PENH = "asia/phnom_penh" + ASIA_PONTIANAK = "asia/pontianak" + ASIA_PYONGYANG = "asia/pyongyang" + ASIA_QATAR = "asia/qatar" + ASIA_QOSTANAY = "asia/qostanay" + ASIA_QYZYLORDA = "asia/qyzylorda" + ASIA_RIYADH = "asia/riyadh" + ASIA_SAKHALIN = "asia/sakhalin" + ASIA_SAMARKAND = "asia/samarkand" + ASIA_SEOUL = "asia/seoul" + ASIA_SHANGHAI = "asia/shanghai" + ASIA_SINGAPORE = "asia/singapore" + ASIA_SREDNEKOLYMSK = "asia/srednekolymsk" + ASIA_TAIPEI = "asia/taipei" + ASIA_TASHKENT = "asia/tashkent" + ASIA_TBILISI = "asia/tbilisi" + ASIA_TEHRAN = "asia/tehran" + ASIA_THIMPHU = "asia/thimphu" + ASIA_TOKYO = "asia/tokyo" + ASIA_TOMSK = "asia/tomsk" + ASIA_ULAANBAATAR = "asia/ulaanbaatar" + ASIA_URUMQI = "asia/urumqi" + ASIA_UST_NERA = "asia/ust-nera" + ASIA_VIENTIANE = "asia/vientiane" + ASIA_VLADIVOSTOK = "asia/vladivostok" + ASIA_YAKUTSK = "asia/yakutsk" + ASIA_YANGON = "asia/yangon" + ASIA_YEKATERINBURG = "asia/yekaterinburg" + ASIA_YEREVAN = "asia/yerevan" + ATLANTIC_AZORES = "atlantic/azores" + ATLANTIC_BERMUDA = "atlantic/bermuda" + ATLANTIC_CANARY = "atlantic/canary" + ATLANTIC_CAPE_VERDE = "atlantic/cape_verde" + ATLANTIC_FAROE = "atlantic/faroe" + ATLANTIC_MADEIRA = "atlantic/madeira" + ATLANTIC_REYKJAVIK = "atlantic/reykjavik" + ATLANTIC_SOUTH_GEORGIA = "atlantic/south_georgia" + ATLANTIC_ST_HELENA = "atlantic/st_helena" + ATLANTIC_STANLEY = "atlantic/stanley" + AUSTRALIA_ADELAIDE = "australia/adelaide" + AUSTRALIA_BRISBANE = "australia/brisbane" + AUSTRALIA_BROKEN_HILL = "australia/broken_hill" + AUSTRALIA_DARWIN = "australia/darwin" + AUSTRALIA_EUCLA = "australia/eucla" + AUSTRALIA_HOBART = "australia/hobart" + AUSTRALIA_LINDEMAN = "australia/lindeman" + AUSTRALIA_LORD_HOWE = "australia/lord_howe" + AUSTRALIA_MELBOURNE = "australia/melbourne" + AUSTRALIA_PERTH = "australia/perth" + AUSTRALIA_SYDNEY = "australia/sydney" + EUROPE_AMSTERDAM = "europe/amsterdam" + EUROPE_ANDORRA = "europe/andorra" + EUROPE_ASTRAKHAN = "europe/astrakhan" + EUROPE_ATHENS = "europe/athens" + EUROPE_BELGRADE = "europe/belgrade" + EUROPE_BERLIN = "europe/berlin" + EUROPE_BRATISLAVA = "europe/bratislava" + EUROPE_BRUSSELS = "europe/brussels" + EUROPE_BUCHAREST = "europe/bucharest" + EUROPE_BUDAPEST = "europe/budapest" + EUROPE_BUSINGEN = "europe/busingen" + EUROPE_CHISINAU = "europe/chisinau" + EUROPE_COPENHAGEN = "europe/copenhagen" + EUROPE_DUBLIN = "europe/dublin" + EUROPE_GIBRALTAR = "europe/gibraltar" + EUROPE_GUERNSEY = "europe/guernsey" + EUROPE_HELSINKI = "europe/helsinki" + EUROPE_ISLE_OF_MAN = "europe/isle_of_man" + EUROPE_ISTANBUL = "europe/istanbul" + EUROPE_JERSEY = "europe/jersey" + EUROPE_KALININGRAD = "europe/kaliningrad" + EUROPE_KIROV = "europe/kirov" + EUROPE_KYIV = "europe/kyiv" + EUROPE_LISBON = "europe/lisbon" + EUROPE_LJUBLJANA = "europe/ljubljana" + EUROPE_LONDON = "europe/london" + EUROPE_LUXEMBOURG = "europe/luxembourg" + EUROPE_MADRID = "europe/madrid" + EUROPE_MALTA = "europe/malta" + EUROPE_MARIEHAMN = "europe/mariehamn" + EUROPE_MINSK = "europe/minsk" + EUROPE_MONACO = "europe/monaco" + EUROPE_MOSCOW = "europe/moscow" + EUROPE_OSLO = "europe/oslo" + EUROPE_PARIS = "europe/paris" + EUROPE_PODGORICA = "europe/podgorica" + EUROPE_PRAGUE = "europe/prague" + EUROPE_RIGA = "europe/riga" + EUROPE_ROME = "europe/rome" + EUROPE_SAMARA = "europe/samara" + EUROPE_SAN_MARINO = "europe/san_marino" + EUROPE_SARAJEVO = "europe/sarajevo" + EUROPE_SARATOV = "europe/saratov" + EUROPE_SIMFEROPOL = "europe/simferopol" + EUROPE_SKOPJE = "europe/skopje" + EUROPE_SOFIA = "europe/sofia" + EUROPE_STOCKHOLM = "europe/stockholm" + EUROPE_TALLINN = "europe/tallinn" + EUROPE_TIRANE = "europe/tirane" + EUROPE_ULYANOVSK = "europe/ulyanovsk" + EUROPE_VADUZ = "europe/vaduz" + EUROPE_VATICAN = "europe/vatican" + EUROPE_VIENNA = "europe/vienna" + EUROPE_VILNIUS = "europe/vilnius" + EUROPE_VOLGOGRAD = "europe/volgograd" + EUROPE_WARSAW = "europe/warsaw" + EUROPE_ZAGREB = "europe/zagreb" + EUROPE_ZURICH = "europe/zurich" + INDIAN_ANTANANARIVO = "indian/antananarivo" + INDIAN_CHAGOS = "indian/chagos" + INDIAN_CHRISTMAS = "indian/christmas" + INDIAN_COCOS = "indian/cocos" + INDIAN_COMORO = "indian/comoro" + INDIAN_KERGUELEN = "indian/kerguelen" + INDIAN_MAHE = "indian/mahe" + INDIAN_MALDIVES = "indian/maldives" + INDIAN_MAURITIUS = "indian/mauritius" + INDIAN_MAYOTTE = "indian/mayotte" + INDIAN_REUNION = "indian/reunion" + PACIFIC_APIA = "pacific/apia" + PACIFIC_AUCKLAND = "pacific/auckland" + PACIFIC_BOUGAINVILLE = "pacific/bougainville" + PACIFIC_CHATHAM = "pacific/chatham" + PACIFIC_CHUUK = "pacific/chuuk" + PACIFIC_EASTER = "pacific/easter" + PACIFIC_EFATE = "pacific/efate" + PACIFIC_FAKAOFO = "pacific/fakaofo" + PACIFIC_FIJI = "pacific/fiji" + PACIFIC_FUNAFUTI = "pacific/funafuti" + PACIFIC_GALAPAGOS = "pacific/galapagos" + PACIFIC_GAMBIER = "pacific/gambier" + PACIFIC_GUADALCANAL = "pacific/guadalcanal" + PACIFIC_GUAM = "pacific/guam" + PACIFIC_HONOLULU = "pacific/honolulu" + PACIFIC_KANTON = "pacific/kanton" + PACIFIC_KIRITIMATI = "pacific/kiritimati" + PACIFIC_KOSRAE = "pacific/kosrae" + PACIFIC_KWAJALEIN = "pacific/kwajalein" + PACIFIC_MAJURO = "pacific/majuro" + PACIFIC_MARQUESAS = "pacific/marquesas" + PACIFIC_MIDWAY = "pacific/midway" + PACIFIC_NAURU = "pacific/nauru" + PACIFIC_NIUE = "pacific/niue" + PACIFIC_NORFOLK = "pacific/norfolk" + PACIFIC_NOUMEA = "pacific/noumea" + PACIFIC_PAGO_PAGO = "pacific/pago_pago" + PACIFIC_PALAU = "pacific/palau" + PACIFIC_PITCAIRN = "pacific/pitcairn" + PACIFIC_POHNPEI = "pacific/pohnpei" + PACIFIC_PORT_MORESBY = "pacific/port_moresby" + PACIFIC_RAROTONGA = "pacific/rarotonga" + PACIFIC_SAIPAN = "pacific/saipan" + PACIFIC_TAHITI = "pacific/tahiti" + PACIFIC_TARAWA = "pacific/tarawa" + PACIFIC_TONGATAPU = "pacific/tongatapu" + PACIFIC_WAKE = "pacific/wake" + PACIFIC_WALLIS = "pacific/wallis" + UTC = "utc" diff --git a/appwrite/enums/vcs_deployment_type.py b/appwrite/enums/vcs_reference_type.py similarity index 72% rename from appwrite/enums/vcs_deployment_type.py rename to appwrite/enums/vcs_reference_type.py index d78e99f..e172e63 100644 --- a/appwrite/enums/vcs_deployment_type.py +++ b/appwrite/enums/vcs_reference_type.py @@ -1,6 +1,6 @@ from enum import Enum -class VCSDeploymentType(Enum): +class VCSReferenceType(Enum): BRANCH = "branch" COMMIT = "commit" TAG = "tag" diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index bb19c28..db5efeb 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -5,6 +5,9 @@ from ..enums.browser import Browser; from ..enums.credit_card import CreditCard; from ..enums.flag import Flag; +from ..enums.theme import Theme; +from ..enums.timezone import Timezone; +from ..enums.output import Output; class Avatars(Service): @@ -313,3 +316,114 @@ def get_qr(self, text: str, size: Optional[float] = None, margin: Optional[float return self.client.call('get', api_path, { }, api_params) + + def get_screenshot(self, url: str, headers: Optional[dict] = None, viewport_width: Optional[float] = None, viewport_height: Optional[float] = None, scale: Optional[float] = None, theme: Optional[Theme] = None, user_agent: Optional[str] = None, fullpage: Optional[bool] = None, locale: Optional[str] = None, timezone: Optional[Timezone] = None, latitude: Optional[float] = None, longitude: Optional[float] = None, accuracy: Optional[float] = None, touch: Optional[bool] = None, permissions: Optional[List[str]] = None, sleep: Optional[float] = None, width: Optional[float] = None, height: Optional[float] = None, quality: Optional[float] = None, output: Optional[Output] = None) -> bytes: + """ + Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. + + You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll. + + When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. + + Parameters + ---------- + url : str + Website URL which you want to capture. + headers : Optional[dict] + HTTP headers to send with the browser request. Defaults to empty. + viewport_width : Optional[float] + Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. + viewport_height : Optional[float] + Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. + scale : Optional[float] + Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. + theme : Optional[Theme] + Browser theme. Pass "light" or "dark". Defaults to "light". + user_agent : Optional[str] + Custom user agent string. Defaults to browser default. + fullpage : Optional[bool] + Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. + locale : Optional[str] + Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. + timezone : Optional[Timezone] + IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. + latitude : Optional[float] + Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. + longitude : Optional[float] + Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. + accuracy : Optional[float] + Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. + touch : Optional[bool] + Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. + permissions : Optional[List[str]] + Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. + sleep : Optional[float] + Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. + width : Optional[float] + Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). + height : Optional[float] + Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). + quality : Optional[float] + Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + output : Optional[Output] + Output format type (jpeg, jpg, png, gif and webp). + + Returns + ------- + bytes + Response as bytes + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/avatars/screenshots' + api_params = {} + if url is None: + raise AppwriteException('Missing required parameter: "url"') + + + api_params['url'] = url + if headers is not None: + api_params['headers'] = headers + if viewport_width is not None: + api_params['viewportWidth'] = viewport_width + if viewport_height is not None: + api_params['viewportHeight'] = viewport_height + if scale is not None: + api_params['scale'] = scale + if theme is not None: + api_params['theme'] = theme + if user_agent is not None: + api_params['userAgent'] = user_agent + if fullpage is not None: + api_params['fullpage'] = fullpage + if locale is not None: + api_params['locale'] = locale + if timezone is not None: + api_params['timezone'] = timezone + if latitude is not None: + api_params['latitude'] = latitude + if longitude is not None: + api_params['longitude'] = longitude + if accuracy is not None: + api_params['accuracy'] = accuracy + if touch is not None: + api_params['touch'] = touch + if permissions is not None: + api_params['permissions'] = permissions + if sleep is not None: + api_params['sleep'] = sleep + if width is not None: + api_params['width'] = width + if height is not None: + api_params['height'] = height + if quality is not None: + api_params['quality'] = quality + if output is not None: + api_params['output'] = output + + return self.client.call('get', api_path, { + }, api_params) diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index ff54cfa..e99a00a 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -503,8 +503,7 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per api_params['collectionId'] = collection_id api_params['name'] = name - if permissions is not None: - api_params['permissions'] = permissions + api_params['permissions'] = permissions if document_security is not None: api_params['documentSecurity'] = document_security if enabled is not None: @@ -602,8 +601,7 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per api_path = api_path.replace('{collectionId}', collection_id) api_params['name'] = name - if permissions is not None: - api_params['permissions'] = permissions + api_params['permissions'] = permissions if document_security is not None: api_params['documentSecurity'] = document_security if enabled is not None: @@ -755,8 +753,7 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -817,8 +814,7 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -876,8 +872,7 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -938,8 +933,7 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -998,8 +992,7 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1061,8 +1054,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1127,8 +1119,7 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str, api_params['key'] = key api_params['elements'] = elements api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1196,8 +1187,7 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, api_params['elements'] = elements api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1260,12 +1250,9 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, api_params['key'] = key api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max - if default is not None: - api_params['default'] = default + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1330,13 +1317,10 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, api_path = api_path.replace('{key}', key) api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max + api_params['min'] = min + api_params['max'] = max api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1399,12 +1383,9 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st api_params['key'] = key api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max - if default is not None: - api_params['default'] = default + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1469,13 +1450,10 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st api_path = api_path.replace('{key}', key) api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max + api_params['min'] = min + api_params['max'] = max api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1534,8 +1512,7 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1597,8 +1574,7 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1713,8 +1689,7 @@ def update_line_attribute(self, database_id: str, collection_id: str, key: str, api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1829,8 +1804,7 @@ def update_point_attribute(self, database_id: str, collection_id: str, key: str, api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1945,8 +1919,7 @@ def update_polygon_attribute(self, database_id: str, collection_id: str, key: st api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2011,10 +1984,8 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re api_params['type'] = type if two_way is not None: api_params['twoWay'] = two_way - if key is not None: - api_params['key'] = key - if two_way_key is not None: - api_params['twoWayKey'] = two_way_key + api_params['key'] = key + api_params['twoWayKey'] = two_way_key if on_delete is not None: api_params['onDelete'] = on_delete @@ -2083,8 +2054,7 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str api_params['key'] = key api_params['size'] = size api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array if encrypt is not None: @@ -2150,10 +2120,8 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str api_params['required'] = required api_params['default'] = default - if size is not None: - api_params['size'] = size - if new_key is not None: - api_params['newKey'] = new_key + api_params['size'] = size + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2212,8 +2180,7 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -2275,8 +2242,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2422,10 +2388,8 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke api_path = api_path.replace('{collectionId}', collection_id) api_path = api_path.replace('{key}', key) - if on_delete is not None: - api_params['onDelete'] = on_delete - if new_key is not None: - api_params['newKey'] = new_key + api_params['onDelete'] = on_delete + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2535,10 +2499,8 @@ def create_document(self, database_id: str, collection_id: str, document_id: str api_params['documentId'] = document_id api_params['data'] = data - if permissions is not None: - api_params['permissions'] = permissions - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['permissions'] = permissions + api_params['transactionId'] = transaction_id return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -2588,8 +2550,7 @@ def create_documents(self, database_id: str, collection_id: str, documents: List api_path = api_path.replace('{collectionId}', collection_id) api_params['documents'] = documents - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -2640,8 +2601,7 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List api_path = api_path.replace('{collectionId}', collection_id) api_params['documents'] = documents - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -2693,8 +2653,7 @@ def update_documents(self, database_id: str, collection_id: str, data: Optional[ api_params['data'] = data if queries is not None: api_params['queries'] = queries - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2742,8 +2701,7 @@ def delete_documents(self, database_id: str, collection_id: str, queries: Option if queries is not None: api_params['queries'] = queries - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('delete', api_path, { 'content-type': 'application/json', @@ -2855,10 +2813,8 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str api_path = api_path.replace('{documentId}', document_id) api_params['data'] = data - if permissions is not None: - api_params['permissions'] = permissions - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['permissions'] = permissions + api_params['transactionId'] = transaction_id return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -2914,10 +2870,8 @@ def update_document(self, database_id: str, collection_id: str, document_id: str if data is not None: api_params['data'] = data - if permissions is not None: - api_params['permissions'] = permissions - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['permissions'] = permissions + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2967,8 +2921,7 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str api_path = api_path.replace('{collectionId}', collection_id) api_path = api_path.replace('{documentId}', document_id) - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('delete', api_path, { 'content-type': 'application/json', @@ -3030,10 +2983,8 @@ def decrement_document_attribute(self, database_id: str, collection_id: str, doc if value is not None: api_params['value'] = value - if min is not None: - api_params['min'] = min - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['min'] = min + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -3095,10 +3046,8 @@ def increment_document_attribute(self, database_id: str, collection_id: str, doc if value is not None: api_params['value'] = value - if max is not None: - api_params['max'] = max - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['max'] = max + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index c190ae6..4828816 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -4,7 +4,8 @@ from appwrite.utils.deprecated import deprecated from ..enums.runtime import Runtime; from ..input_file import InputFile -from ..enums.vcs_deployment_type import VCSDeploymentType; +from ..enums.template_reference_type import TemplateReferenceType; +from ..enums.vcs_reference_type import VCSReferenceType; from ..enums.deployment_download_type import DeploymentDownloadType; from ..enums.execution_method import ExecutionMethod; @@ -546,7 +547,7 @@ def create_duplicate_deployment(self, function_id: str, deployment_id: str, buil 'content-type': 'application/json', }, api_params) - def create_template_deployment(self, function_id: str, repository: str, owner: str, root_directory: str, version: str, activate: Optional[bool] = None) -> Dict[str, Any]: + def create_template_deployment(self, function_id: str, repository: str, owner: str, root_directory: str, type: TemplateReferenceType, reference: str, activate: Optional[bool] = None) -> Dict[str, Any]: """ Create a deployment based on a template. @@ -562,8 +563,10 @@ def create_template_deployment(self, function_id: str, repository: str, owner: s The name of the owner of the template. root_directory : str Path to function code in the template repo. - version : str - Version (tag) for the repo linked to the function template. + type : TemplateReferenceType + Type for the reference provided. Can be commit, branch, or tag + reference : str + Reference value, can be a commit hash, branch name, or release tag activate : Optional[bool] Automatically activate the deployment when it is finished building. @@ -592,15 +595,19 @@ def create_template_deployment(self, function_id: str, repository: str, owner: s if root_directory is None: raise AppwriteException('Missing required parameter: "root_directory"') - if version is None: - raise AppwriteException('Missing required parameter: "version"') + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + if reference is None: + raise AppwriteException('Missing required parameter: "reference"') api_path = api_path.replace('{functionId}', function_id) api_params['repository'] = repository api_params['owner'] = owner api_params['rootDirectory'] = root_directory - api_params['version'] = version + api_params['type'] = type + api_params['reference'] = reference if activate is not None: api_params['activate'] = activate @@ -608,7 +615,7 @@ def create_template_deployment(self, function_id: str, repository: str, owner: s 'content-type': 'application/json', }, api_params) - def create_vcs_deployment(self, function_id: str, type: VCSDeploymentType, reference: str, activate: Optional[bool] = None) -> Dict[str, Any]: + def create_vcs_deployment(self, function_id: str, type: VCSReferenceType, reference: str, activate: Optional[bool] = None) -> Dict[str, Any]: """ Create a deployment when a function is connected to VCS. @@ -618,7 +625,7 @@ def create_vcs_deployment(self, function_id: str, type: VCSDeploymentType, refer ---------- function_id : str Function ID. - type : VCSDeploymentType + type : VCSReferenceType Type of reference passed. Allowed values are: branch, commit reference : str VCS reference to create deployment from. Depending on type this can be: branch name, commit hash @@ -900,8 +907,7 @@ def create_execution(self, function_id: str, body: Optional[str] = None, xasync: api_params['method'] = method if headers is not None: api_params['headers'] = headers - if scheduled_at is not None: - api_params['scheduledAt'] = scheduled_at + api_params['scheduledAt'] = scheduled_at return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1141,10 +1147,8 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: O api_path = api_path.replace('{variableId}', variable_id) api_params['key'] = key - if value is not None: - api_params['value'] = value - if secret is not None: - api_params['secret'] = secret + api_params['value'] = value + api_params['secret'] = secret return self.client.call('put', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 4ef91ba..4a5564b 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -120,8 +120,7 @@ def create_email(self, message_id: str, subject: str, content: str, topics: Opti api_params['draft'] = draft if html is not None: api_params['html'] = html - if scheduled_at is not None: - api_params['scheduledAt'] = scheduled_at + api_params['scheduledAt'] = scheduled_at return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -177,28 +176,17 @@ def update_email(self, message_id: str, topics: Optional[List[str]] = None, user api_path = api_path.replace('{messageId}', message_id) - if topics is not None: - api_params['topics'] = topics - if users is not None: - api_params['users'] = users - if targets is not None: - api_params['targets'] = targets - if subject is not None: - api_params['subject'] = subject - if content is not None: - api_params['content'] = content - if draft is not None: - api_params['draft'] = draft - if html is not None: - api_params['html'] = html - if cc is not None: - api_params['cc'] = cc - if bcc is not None: - api_params['bcc'] = bcc - if scheduled_at is not None: - api_params['scheduledAt'] = scheduled_at - if attachments is not None: - api_params['attachments'] = attachments + api_params['topics'] = topics + api_params['users'] = users + api_params['targets'] = targets + api_params['subject'] = subject + api_params['content'] = content + api_params['draft'] = draft + api_params['html'] = html + api_params['cc'] = cc + api_params['bcc'] = bcc + api_params['scheduledAt'] = scheduled_at + api_params['attachments'] = attachments return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -277,8 +265,7 @@ def create_push(self, message_id: str, title: Optional[str] = None, body: Option api_params['users'] = users if targets is not None: api_params['targets'] = targets - if data is not None: - api_params['data'] = data + api_params['data'] = data if action is not None: api_params['action'] = action if image is not None: @@ -295,8 +282,7 @@ def create_push(self, message_id: str, title: Optional[str] = None, body: Option api_params['badge'] = badge if draft is not None: api_params['draft'] = draft - if scheduled_at is not None: - api_params['scheduledAt'] = scheduled_at + api_params['scheduledAt'] = scheduled_at if content_available is not None: api_params['contentAvailable'] = content_available if critical is not None: @@ -372,42 +358,24 @@ def update_push(self, message_id: str, topics: Optional[List[str]] = None, users api_path = api_path.replace('{messageId}', message_id) - if topics is not None: - api_params['topics'] = topics - if users is not None: - api_params['users'] = users - if targets is not None: - api_params['targets'] = targets - if title is not None: - api_params['title'] = title - if body is not None: - api_params['body'] = body - if data is not None: - api_params['data'] = data - if action is not None: - api_params['action'] = action - if image is not None: - api_params['image'] = image - if icon is not None: - api_params['icon'] = icon - if sound is not None: - api_params['sound'] = sound - if color is not None: - api_params['color'] = color - if tag is not None: - api_params['tag'] = tag - if badge is not None: - api_params['badge'] = badge - if draft is not None: - api_params['draft'] = draft - if scheduled_at is not None: - api_params['scheduledAt'] = scheduled_at - if content_available is not None: - api_params['contentAvailable'] = content_available - if critical is not None: - api_params['critical'] = critical - if priority is not None: - api_params['priority'] = priority + api_params['topics'] = topics + api_params['users'] = users + api_params['targets'] = targets + api_params['title'] = title + api_params['body'] = body + api_params['data'] = data + api_params['action'] = action + api_params['image'] = image + api_params['icon'] = icon + api_params['sound'] = sound + api_params['color'] = color + api_params['tag'] = tag + api_params['badge'] = badge + api_params['draft'] = draft + api_params['scheduledAt'] = scheduled_at + api_params['contentAvailable'] = content_available + api_params['critical'] = critical + api_params['priority'] = priority return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -464,8 +432,7 @@ def create_sms(self, message_id: str, content: str, topics: Optional[List[str]] api_params['targets'] = targets if draft is not None: api_params['draft'] = draft - if scheduled_at is not None: - api_params['scheduledAt'] = scheduled_at + api_params['scheduledAt'] = scheduled_at return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -511,18 +478,12 @@ def update_sms(self, message_id: str, topics: Optional[List[str]] = None, users: api_path = api_path.replace('{messageId}', message_id) - if topics is not None: - api_params['topics'] = topics - if users is not None: - api_params['users'] = users - if targets is not None: - api_params['targets'] = targets - if content is not None: - api_params['content'] = content - if draft is not None: - api_params['draft'] = draft - if scheduled_at is not None: - api_params['scheduledAt'] = scheduled_at + api_params['topics'] = topics + api_params['users'] = users + api_params['targets'] = targets + api_params['content'] = content + api_params['draft'] = draft + api_params['scheduledAt'] = scheduled_at return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -762,8 +723,7 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: Optional[s api_params['bundleId'] = bundle_id if sandbox is not None: api_params['sandbox'] = sandbox - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -812,8 +772,7 @@ def update_apns_provider(self, provider_id: str, name: Optional[str] = None, ena if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if auth_key is not None: api_params['authKey'] = auth_key if auth_key_id is not None: @@ -822,8 +781,7 @@ def update_apns_provider(self, provider_id: str, name: Optional[str] = None, ena api_params['teamId'] = team_id if bundle_id is not None: api_params['bundleId'] = bundle_id - if sandbox is not None: - api_params['sandbox'] = sandbox + api_params['sandbox'] = sandbox return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -866,10 +824,8 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: api_params['providerId'] = provider_id api_params['name'] = name - if service_account_json is not None: - api_params['serviceAccountJSON'] = service_account_json - if enabled is not None: - api_params['enabled'] = enabled + api_params['serviceAccountJSON'] = service_account_json + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -910,10 +866,8 @@ def update_fcm_provider(self, provider_id: str, name: Optional[str] = None, enab if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled - if service_account_json is not None: - api_params['serviceAccountJSON'] = service_account_json + api_params['enabled'] = enabled + api_params['serviceAccountJSON'] = service_account_json return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -972,8 +926,7 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: Optional api_params['apiKey'] = api_key if domain is not None: api_params['domain'] = domain - if is_eu_region is not None: - api_params['isEuRegion'] = is_eu_region + api_params['isEuRegion'] = is_eu_region if from_name is not None: api_params['fromName'] = from_name if from_email is not None: @@ -982,8 +935,7 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: Optional api_params['replyToName'] = reply_to_name if reply_to_email is not None: api_params['replyToEmail'] = reply_to_email - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1040,10 +992,8 @@ def update_mailgun_provider(self, provider_id: str, name: Optional[str] = None, api_params['apiKey'] = api_key if domain is not None: api_params['domain'] = domain - if is_eu_region is not None: - api_params['isEuRegion'] = is_eu_region - if enabled is not None: - api_params['enabled'] = enabled + api_params['isEuRegion'] = is_eu_region + api_params['enabled'] = enabled if from_name is not None: api_params['fromName'] = from_name if from_email is not None: @@ -1104,8 +1054,7 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: Option api_params['senderId'] = sender_id if auth_key is not None: api_params['authKey'] = auth_key - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1150,8 +1099,7 @@ def update_msg91_provider(self, provider_id: str, name: Optional[str] = None, en if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if template_id is not None: api_params['templateId'] = template_id if sender_id is not None: @@ -1218,8 +1166,7 @@ def create_resend_provider(self, provider_id: str, name: str, api_key: Optional[ api_params['replyToName'] = reply_to_name if reply_to_email is not None: api_params['replyToEmail'] = reply_to_email - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1268,8 +1215,7 @@ def update_resend_provider(self, provider_id: str, name: Optional[str] = None, e if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if api_key is not None: api_params['apiKey'] = api_key if from_name is not None: @@ -1340,8 +1286,7 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: Optiona api_params['replyToName'] = reply_to_name if reply_to_email is not None: api_params['replyToEmail'] = reply_to_email - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1390,8 +1335,7 @@ def update_sendgrid_provider(self, provider_id: str, name: Optional[str] = None, if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if api_key is not None: api_params['apiKey'] = api_key if from_name is not None: @@ -1488,8 +1432,7 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: Opt api_params['replyToName'] = reply_to_name if reply_to_email is not None: api_params['replyToEmail'] = reply_to_email - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1552,16 +1495,14 @@ def update_smtp_provider(self, provider_id: str, name: Optional[str] = None, hos api_params['name'] = name if host is not None: api_params['host'] = host - if port is not None: - api_params['port'] = port + api_params['port'] = port if username is not None: api_params['username'] = username if password is not None: api_params['password'] = password if encryption is not None: api_params['encryption'] = encryption - if auto_tls is not None: - api_params['autoTLS'] = auto_tls + api_params['autoTLS'] = auto_tls if mailer is not None: api_params['mailer'] = mailer if from_name is not None: @@ -1572,8 +1513,7 @@ def update_smtp_provider(self, provider_id: str, name: Optional[str] = None, hos api_params['replyToName'] = reply_to_name if reply_to_email is not None: api_params['replyToEmail'] = reply_to_email - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1626,8 +1566,7 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: Optional[ api_params['customerId'] = customer_id if api_key is not None: api_params['apiKey'] = api_key - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1672,8 +1611,7 @@ def update_telesign_provider(self, provider_id: str, name: Optional[str] = None, if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if customer_id is not None: api_params['customerId'] = customer_id if api_key is not None: @@ -1732,8 +1670,7 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: Optional api_params['username'] = username if api_key is not None: api_params['apiKey'] = api_key - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1778,8 +1715,7 @@ def update_textmagic_provider(self, provider_id: str, name: Optional[str] = None if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if username is not None: api_params['username'] = username if api_key is not None: @@ -1838,8 +1774,7 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: Optional[st api_params['accountSid'] = account_sid if auth_token is not None: api_params['authToken'] = auth_token - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1884,8 +1819,7 @@ def update_twilio_provider(self, provider_id: str, name: Optional[str] = None, e if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if account_sid is not None: api_params['accountSid'] = account_sid if auth_token is not None: @@ -1944,8 +1878,7 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: Optional[st api_params['apiKey'] = api_key if api_secret is not None: api_params['apiSecret'] = api_secret - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1990,8 +1923,7 @@ def update_vonage_provider(self, provider_id: str, name: Optional[str] = None, e if name is not None: api_params['name'] = name - if enabled is not None: - api_params['enabled'] = enabled + api_params['enabled'] = enabled if api_key is not None: api_params['apiKey'] = api_key if api_secret is not None: @@ -2288,10 +2220,8 @@ def update_topic(self, topic_id: str, name: Optional[str] = None, subscribe: Opt api_path = api_path.replace('{topicId}', topic_id) - if name is not None: - api_params['name'] = name - if subscribe is not None: - api_params['subscribe'] = subscribe + api_params['name'] = name + api_params['subscribe'] = subscribe return self.client.call('patch', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index 6980364..292e696 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -6,7 +6,8 @@ from ..enums.build_runtime import BuildRuntime; from ..enums.adapter import Adapter; from ..input_file import InputFile -from ..enums.vcs_deployment_type import VCSDeploymentType; +from ..enums.template_reference_type import TemplateReferenceType; +from ..enums.vcs_reference_type import VCSReferenceType; from ..enums.deployment_download_type import DeploymentDownloadType; class Sites(Service): @@ -449,7 +450,7 @@ def list_deployments(self, site_id: str, queries: Optional[List[str]] = None, se def create_deployment(self, site_id: str, code: InputFile, activate: bool, install_command: Optional[str] = None, build_command: Optional[str] = None, output_directory: Optional[str] = None, on_progress = None) -> Dict[str, Any]: """ - Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. + Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. Parameters ---------- @@ -548,7 +549,7 @@ def create_duplicate_deployment(self, site_id: str, deployment_id: str) -> Dict[ 'content-type': 'application/json', }, api_params) - def create_template_deployment(self, site_id: str, repository: str, owner: str, root_directory: str, version: str, activate: Optional[bool] = None) -> Dict[str, Any]: + def create_template_deployment(self, site_id: str, repository: str, owner: str, root_directory: str, type: TemplateReferenceType, reference: str, activate: Optional[bool] = None) -> Dict[str, Any]: """ Create a deployment based on a template. @@ -564,8 +565,10 @@ def create_template_deployment(self, site_id: str, repository: str, owner: str, The name of the owner of the template. root_directory : str Path to site code in the template repo. - version : str - Version (tag) for the repo linked to the site template. + type : TemplateReferenceType + Type for the reference provided. Can be commit, branch, or tag + reference : str + Reference value, can be a commit hash, branch name, or release tag activate : Optional[bool] Automatically activate the deployment when it is finished building. @@ -594,15 +597,19 @@ def create_template_deployment(self, site_id: str, repository: str, owner: str, if root_directory is None: raise AppwriteException('Missing required parameter: "root_directory"') - if version is None: - raise AppwriteException('Missing required parameter: "version"') + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + if reference is None: + raise AppwriteException('Missing required parameter: "reference"') api_path = api_path.replace('{siteId}', site_id) api_params['repository'] = repository api_params['owner'] = owner api_params['rootDirectory'] = root_directory - api_params['version'] = version + api_params['type'] = type + api_params['reference'] = reference if activate is not None: api_params['activate'] = activate @@ -610,7 +617,7 @@ def create_template_deployment(self, site_id: str, repository: str, owner: str, 'content-type': 'application/json', }, api_params) - def create_vcs_deployment(self, site_id: str, type: VCSDeploymentType, reference: str, activate: Optional[bool] = None) -> Dict[str, Any]: + def create_vcs_deployment(self, site_id: str, type: VCSReferenceType, reference: str, activate: Optional[bool] = None) -> Dict[str, Any]: """ Create a deployment when a site is connected to VCS. @@ -620,7 +627,7 @@ def create_vcs_deployment(self, site_id: str, type: VCSDeploymentType, reference ---------- site_id : str Site ID. - type : VCSDeploymentType + type : VCSReferenceType Type of reference passed. Allowed values are: branch, commit reference : str VCS reference to create deployment from. Depending on type this can be: branch name, commit hash @@ -1087,10 +1094,8 @@ def update_variable(self, site_id: str, variable_id: str, key: str, value: Optio api_path = api_path.replace('{variableId}', variable_id) api_params['key'] = key - if value is not None: - api_params['value'] = value - if secret is not None: - api_params['secret'] = secret + api_params['value'] = value + api_params['secret'] = secret return self.client.call('put', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 1c25c46..d07b1fc 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -19,7 +19,7 @@ def list_buckets(self, queries: Optional[List[str]] = None, search: Optional[str Parameters ---------- queries : Optional[List[str]] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations search : Optional[str] Search term to filter your list results. Max length: 256 chars. total : Optional[bool] @@ -49,7 +49,7 @@ def list_buckets(self, queries: Optional[List[str]] = None, search: Optional[str return self.client.call('get', api_path, { }, api_params) - def create_bucket(self, bucket_id: str, name: str, permissions: Optional[List[str]] = None, file_security: Optional[bool] = None, enabled: Optional[bool] = None, maximum_file_size: Optional[float] = None, allowed_file_extensions: Optional[List[str]] = None, compression: Optional[Compression] = None, encryption: Optional[bool] = None, antivirus: Optional[bool] = None) -> Dict[str, Any]: + def create_bucket(self, bucket_id: str, name: str, permissions: Optional[List[str]] = None, file_security: Optional[bool] = None, enabled: Optional[bool] = None, maximum_file_size: Optional[float] = None, allowed_file_extensions: Optional[List[str]] = None, compression: Optional[Compression] = None, encryption: Optional[bool] = None, antivirus: Optional[bool] = None, transformations: Optional[bool] = None) -> Dict[str, Any]: """ Create a new storage bucket. @@ -75,6 +75,8 @@ def create_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled antivirus : Optional[bool] Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + transformations : Optional[bool] + Are image transformations enabled? Returns ------- @@ -98,8 +100,7 @@ def create_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st api_params['bucketId'] = bucket_id api_params['name'] = name - if permissions is not None: - api_params['permissions'] = permissions + api_params['permissions'] = permissions if file_security is not None: api_params['fileSecurity'] = file_security if enabled is not None: @@ -114,6 +115,8 @@ def create_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st api_params['encryption'] = encryption if antivirus is not None: api_params['antivirus'] = antivirus + if transformations is not None: + api_params['transformations'] = transformations return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -150,7 +153,7 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - def update_bucket(self, bucket_id: str, name: str, permissions: Optional[List[str]] = None, file_security: Optional[bool] = None, enabled: Optional[bool] = None, maximum_file_size: Optional[float] = None, allowed_file_extensions: Optional[List[str]] = None, compression: Optional[Compression] = None, encryption: Optional[bool] = None, antivirus: Optional[bool] = None) -> Dict[str, Any]: + def update_bucket(self, bucket_id: str, name: str, permissions: Optional[List[str]] = None, file_security: Optional[bool] = None, enabled: Optional[bool] = None, maximum_file_size: Optional[float] = None, allowed_file_extensions: Optional[List[str]] = None, compression: Optional[Compression] = None, encryption: Optional[bool] = None, antivirus: Optional[bool] = None, transformations: Optional[bool] = None) -> Dict[str, Any]: """ Update a storage bucket by its unique ID. @@ -176,6 +179,8 @@ def update_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled antivirus : Optional[bool] Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + transformations : Optional[bool] + Are image transformations enabled? Returns ------- @@ -199,8 +204,7 @@ def update_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st api_path = api_path.replace('{bucketId}', bucket_id) api_params['name'] = name - if permissions is not None: - api_params['permissions'] = permissions + api_params['permissions'] = permissions if file_security is not None: api_params['fileSecurity'] = file_security if enabled is not None: @@ -215,6 +219,8 @@ def update_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st api_params['encryption'] = encryption if antivirus is not None: api_params['antivirus'] = antivirus + if transformations is not None: + api_params['transformations'] = transformations return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -432,10 +438,8 @@ def update_file(self, bucket_id: str, file_id: str, name: Optional[str] = None, api_path = api_path.replace('{bucketId}', bucket_id) api_path = api_path.replace('{fileId}', file_id) - if name is not None: - api_params['name'] = name - if permissions is not None: - api_params['permissions'] = permissions + api_params['name'] = name + api_params['permissions'] = permissions return self.client.call('put', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/tables_db.py b/appwrite/services/tables_db.py index 5318ca4..dcef276 100644 --- a/appwrite/services/tables_db.py +++ b/appwrite/services/tables_db.py @@ -482,8 +482,7 @@ def create_table(self, database_id: str, table_id: str, name: str, permissions: api_params['tableId'] = table_id api_params['name'] = name - if permissions is not None: - api_params['permissions'] = permissions + api_params['permissions'] = permissions if row_security is not None: api_params['rowSecurity'] = row_security if enabled is not None: @@ -545,7 +544,7 @@ def update_table(self, database_id: str, table_id: str, name: str, permissions: permissions : Optional[List[str]] An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). row_security : Optional[bool] - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). enabled : Optional[bool] Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. @@ -575,8 +574,7 @@ def update_table(self, database_id: str, table_id: str, name: str, permissions: api_path = api_path.replace('{tableId}', table_id) api_params['name'] = name - if permissions is not None: - api_params['permissions'] = permissions + api_params['permissions'] = permissions if row_security is not None: api_params['rowSecurity'] = row_security if enabled is not None: @@ -719,8 +717,7 @@ def create_boolean_column(self, database_id: str, table_id: str, key: str, requi api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -778,8 +775,7 @@ def update_boolean_column(self, database_id: str, table_id: str, key: str, requi api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -834,8 +830,7 @@ def create_datetime_column(self, database_id: str, table_id: str, key: str, requ api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -893,8 +888,7 @@ def update_datetime_column(self, database_id: str, table_id: str, key: str, requ api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -950,8 +944,7 @@ def create_email_column(self, database_id: str, table_id: str, key: str, require api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1010,8 +1003,7 @@ def update_email_column(self, database_id: str, table_id: str, key: str, require api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1072,8 +1064,7 @@ def create_enum_column(self, database_id: str, table_id: str, key: str, elements api_params['key'] = key api_params['elements'] = elements api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1138,8 +1129,7 @@ def update_enum_column(self, database_id: str, table_id: str, key: str, elements api_params['elements'] = elements api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1199,12 +1189,9 @@ def create_float_column(self, database_id: str, table_id: str, key: str, require api_params['key'] = key api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max - if default is not None: - api_params['default'] = default + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1266,13 +1253,10 @@ def update_float_column(self, database_id: str, table_id: str, key: str, require api_path = api_path.replace('{key}', key) api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max + api_params['min'] = min + api_params['max'] = max api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1332,12 +1316,9 @@ def create_integer_column(self, database_id: str, table_id: str, key: str, requi api_params['key'] = key api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max - if default is not None: - api_params['default'] = default + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1399,13 +1380,10 @@ def update_integer_column(self, database_id: str, table_id: str, key: str, requi api_path = api_path.replace('{key}', key) api_params['required'] = required - if min is not None: - api_params['min'] = min - if max is not None: - api_params['max'] = max + api_params['min'] = min + api_params['max'] = max api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1461,8 +1439,7 @@ def create_ip_column(self, database_id: str, table_id: str, key: str, required: api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -1521,8 +1498,7 @@ def update_ip_column(self, database_id: str, table_id: str, key: str, required: api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1631,8 +1607,7 @@ def update_line_column(self, database_id: str, table_id: str, key: str, required api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1741,8 +1716,7 @@ def update_point_column(self, database_id: str, table_id: str, key: str, require api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1851,8 +1825,7 @@ def update_polygon_column(self, database_id: str, table_id: str, key: str, requi api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -1914,10 +1887,8 @@ def create_relationship_column(self, database_id: str, table_id: str, related_ta api_params['type'] = type if two_way is not None: api_params['twoWay'] = two_way - if key is not None: - api_params['key'] = key - if two_way_key is not None: - api_params['twoWayKey'] = two_way_key + api_params['key'] = key + api_params['twoWayKey'] = two_way_key if on_delete is not None: api_params['onDelete'] = on_delete @@ -1983,8 +1954,7 @@ def create_string_column(self, database_id: str, table_id: str, key: str, size: api_params['key'] = key api_params['size'] = size api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array if encrypt is not None: @@ -2047,10 +2017,8 @@ def update_string_column(self, database_id: str, table_id: str, key: str, requir api_params['required'] = required api_params['default'] = default - if size is not None: - api_params['size'] = size - if new_key is not None: - api_params['newKey'] = new_key + api_params['size'] = size + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2106,8 +2074,7 @@ def create_url_column(self, database_id: str, table_id: str, key: str, required: api_params['key'] = key api_params['required'] = required - if default is not None: - api_params['default'] = default + api_params['default'] = default if array is not None: api_params['array'] = array @@ -2166,8 +2133,7 @@ def update_url_column(self, database_id: str, table_id: str, key: str, required: api_params['required'] = required api_params['default'] = default - if new_key is not None: - api_params['newKey'] = new_key + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2304,10 +2270,8 @@ def update_relationship_column(self, database_id: str, table_id: str, key: str, api_path = api_path.replace('{tableId}', table_id) api_path = api_path.replace('{key}', key) - if on_delete is not None: - api_params['onDelete'] = on_delete - if new_key is not None: - api_params['newKey'] = new_key + api_params['onDelete'] = on_delete + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2608,10 +2572,8 @@ def create_row(self, database_id: str, table_id: str, row_id: str, data: dict, p api_params['rowId'] = row_id api_params['data'] = data - if permissions is not None: - api_params['permissions'] = permissions - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['permissions'] = permissions + api_params['transactionId'] = transaction_id return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -2658,8 +2620,7 @@ def create_rows(self, database_id: str, table_id: str, rows: List[dict], transac api_path = api_path.replace('{tableId}', table_id) api_params['rows'] = rows - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -2707,8 +2668,7 @@ def upsert_rows(self, database_id: str, table_id: str, rows: List[dict], transac api_path = api_path.replace('{tableId}', table_id) api_params['rows'] = rows - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -2757,8 +2717,7 @@ def update_rows(self, database_id: str, table_id: str, data: Optional[dict] = No api_params['data'] = data if queries is not None: api_params['queries'] = queries - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -2803,8 +2762,7 @@ def delete_rows(self, database_id: str, table_id: str, queries: Optional[List[st if queries is not None: api_params['queries'] = queries - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('delete', api_path, { 'content-type': 'application/json', @@ -2908,10 +2866,8 @@ def upsert_row(self, database_id: str, table_id: str, row_id: str, data: Optiona if data is not None: api_params['data'] = data - if permissions is not None: - api_params['permissions'] = permissions - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['permissions'] = permissions + api_params['transactionId'] = transaction_id return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -2964,10 +2920,8 @@ def update_row(self, database_id: str, table_id: str, row_id: str, data: Optiona if data is not None: api_params['data'] = data - if permissions is not None: - api_params['permissions'] = permissions - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['permissions'] = permissions + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -3014,8 +2968,7 @@ def delete_row(self, database_id: str, table_id: str, row_id: str, transaction_i api_path = api_path.replace('{tableId}', table_id) api_path = api_path.replace('{rowId}', row_id) - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['transactionId'] = transaction_id return self.client.call('delete', api_path, { 'content-type': 'application/json', @@ -3074,10 +3027,8 @@ def decrement_row_column(self, database_id: str, table_id: str, row_id: str, col if value is not None: api_params['value'] = value - if min is not None: - api_params['min'] = min - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['min'] = min + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -3136,10 +3087,8 @@ def increment_row_column(self, database_id: str, table_id: str, row_id: str, col if value is not None: api_params['value'] = value - if max is not None: - api_params['max'] = max - if transaction_id is not None: - api_params['transactionId'] = transaction_id + api_params['max'] = max + api_params['transactionId'] = transaction_id return self.client.call('patch', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 1a1bbca..afaa9aa 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -83,10 +83,8 @@ def create(self, user_id: str, email: Optional[str] = None, phone: Optional[str] api_params['userId'] = user_id - if email is not None: - api_params['email'] = email - if phone is not None: - api_params['phone'] = phone + api_params['email'] = email + api_params['phone'] = phone if password is not None: api_params['password'] = password if name is not None: diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md new file mode 100644 index 0000000..fe7073e --- /dev/null +++ b/docs/examples/avatars/get-screenshot.md @@ -0,0 +1,35 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars +from appwrite.enums import Theme +from appwrite.enums import Timezone +from appwrite.enums import Output + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_screenshot( + url = 'https://example.com', + headers = {}, # optional + viewport_width = 1, # optional + viewport_height = 1, # optional + scale = 0.1, # optional + theme = Theme.LIGHT, # optional + user_agent = '', # optional + fullpage = False, # optional + locale = '', # optional + timezone = Timezone.AFRICA_ABIDJAN, # optional + latitude = -90, # optional + longitude = -180, # optional + accuracy = 0, # optional + touch = False, # optional + permissions = [], # optional + sleep = 0, # optional + width = 0, # optional + height = 0, # optional + quality = -1, # optional + output = Output.JPG # optional +) diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 6c8f4dc..ea859fc 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,6 +1,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases from appwrite.enums import RelationshipType +from appwrite.enums import RelationMutate client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 3b6c8e9..8f5b0d8 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.databases import Databases +from appwrite.enums import RelationMutate client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index f80b864..8361351 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.functions import Functions +from appwrite.enums import ExecutionMethod client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md index 6083cc1..db2058a 100644 --- a/docs/examples/functions/create-template-deployment.md +++ b/docs/examples/functions/create-template-deployment.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.functions import Functions +from appwrite.enums import TemplateReferenceType client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -13,6 +14,7 @@ result = functions.create_template_deployment( repository = '', owner = '', root_directory = '', - version = '', + type = TemplateReferenceType.COMMIT, + reference = '', activate = False # optional ) diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md index 4004bae..43e198b 100644 --- a/docs/examples/functions/create-vcs-deployment.md +++ b/docs/examples/functions/create-vcs-deployment.md @@ -1,6 +1,6 @@ from appwrite.client import Client from appwrite.services.functions import Functions -from appwrite.enums import VCSDeploymentType +from appwrite.enums import VCSReferenceType client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -11,7 +11,7 @@ functions = Functions(client) result = functions.create_vcs_deployment( function_id = '', - type = VCSDeploymentType.BRANCH, + type = VCSReferenceType.BRANCH, reference = '', activate = False # optional ) diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 8758e27..98e16eb 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,6 +1,6 @@ from appwrite.client import Client from appwrite.services.functions import Functions -from appwrite.enums import +from appwrite.enums import Runtime client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -12,7 +12,7 @@ functions = Functions(client) result = functions.create( function_id = '', name = '', - runtime = .NODE_14_5, + runtime = Runtime.NODE_14_5, execute = ["any"], # optional events = [], # optional schedule = '', # optional diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index 1b0673c..c633a89 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.functions import Functions +from appwrite.enums import DeploymentDownloadType client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 64ee39b..841c1eb 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.functions import Functions +from appwrite.enums import Runtime client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -11,7 +12,7 @@ functions = Functions(client) result = functions.update( function_id = '', name = '', - runtime = .NODE_14_5, # optional + runtime = Runtime.NODE_14_5, # optional execute = ["any"], # optional events = [], # optional schedule = '', # optional diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 5362a2d..6db2824 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,6 +1,6 @@ from appwrite.client import Client from appwrite.services.health import Health -from appwrite.enums import +from appwrite.enums import Name client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -10,6 +10,6 @@ client.set_key('') # Your secret API key health = Health(client) result = health.get_failed_jobs( - name = .V1_DATABASE, + name = Name.V1_DATABASE, threshold = None # optional ) diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index b706234..817c157 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging +from appwrite.enums import MessagePriority client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 99914f0..6b9c345 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging +from appwrite.enums import SmtpEncryption client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index ce5d394..f990132 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging +from appwrite.enums import MessagePriority client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 80019aa..51f54a3 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging +from appwrite.enums import SmtpEncryption client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md index ac05f9e..700ca44 100644 --- a/docs/examples/sites/create-template-deployment.md +++ b/docs/examples/sites/create-template-deployment.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.sites import Sites +from appwrite.enums import TemplateReferenceType client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -13,6 +14,7 @@ result = sites.create_template_deployment( repository = '', owner = '', root_directory = '', - version = '', + type = TemplateReferenceType.BRANCH, + reference = '', activate = False # optional ) diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md index 089e6c8..ec02f31 100644 --- a/docs/examples/sites/create-vcs-deployment.md +++ b/docs/examples/sites/create-vcs-deployment.md @@ -1,6 +1,6 @@ from appwrite.client import Client from appwrite.services.sites import Sites -from appwrite.enums import VCSDeploymentType +from appwrite.enums import VCSReferenceType client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -11,7 +11,7 @@ sites = Sites(client) result = sites.create_vcs_deployment( site_id = '', - type = VCSDeploymentType.BRANCH, + type = VCSReferenceType.BRANCH, reference = '', activate = False # optional ) diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 4950cd2..436e56a 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -1,7 +1,8 @@ from appwrite.client import Client from appwrite.services.sites import Sites -from appwrite.enums import -from appwrite.enums import +from appwrite.enums import Framework +from appwrite.enums import BuildRuntime +from appwrite.enums import Adapter client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -13,15 +14,15 @@ sites = Sites(client) result = sites.create( site_id = '', name = '', - framework = .ANALOG, - build_runtime = .NODE_14_5, + framework = Framework.ANALOG, + build_runtime = BuildRuntime.NODE_14_5, enabled = False, # optional logging = False, # optional timeout = 1, # optional install_command = '', # optional build_command = '', # optional output_directory = '', # optional - adapter = .STATIC, # optional + adapter = Adapter.STATIC, # optional installation_id = '', # optional fallback_file = '', # optional provider_repository_id = '', # optional diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index d6af564..7eaa105 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.sites import Sites +from appwrite.enums import DeploymentDownloadType client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 7d2d286..56b796c 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -1,6 +1,8 @@ from appwrite.client import Client from appwrite.services.sites import Sites -from appwrite.enums import +from appwrite.enums import Framework +from appwrite.enums import BuildRuntime +from appwrite.enums import Adapter client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -12,15 +14,15 @@ sites = Sites(client) result = sites.update( site_id = '', name = '', - framework = .ANALOG, + framework = Framework.ANALOG, enabled = False, # optional logging = False, # optional timeout = 1, # optional install_command = '', # optional build_command = '', # optional output_directory = '', # optional - build_runtime = .NODE_14_5, # optional - adapter = .STATIC, # optional + build_runtime = BuildRuntime.NODE_14_5, # optional + adapter = Adapter.STATIC, # optional fallback_file = '', # optional installation_id = '', # optional provider_repository_id = '', # optional diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index e08b2d0..10310ae 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.storage import Storage +from appwrite.enums import Compression from appwrite.permission import Permission from appwrite.role import Role @@ -18,7 +19,8 @@ result = storage.create_bucket( enabled = False, # optional maximum_file_size = 1, # optional allowed_file_extensions = [], # optional - compression = .NONE, # optional + compression = Compression.NONE, # optional encryption = False, # optional - antivirus = False # optional + antivirus = False, # optional + transformations = False # optional ) diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 47e3f23..f962edc 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,5 +1,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage +from appwrite.enums import ImageGravity +from appwrite.enums import ImageFormat client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index bfa7cc3..b072638 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.storage import Storage +from appwrite.enums import Compression from appwrite.permission import Permission from appwrite.role import Role @@ -18,7 +19,8 @@ result = storage.update_bucket( enabled = False, # optional maximum_file_size = 1, # optional allowed_file_extensions = [], # optional - compression = .NONE, # optional + compression = Compression.NONE, # optional encryption = False, # optional - antivirus = False # optional + antivirus = False, # optional + transformations = False # optional ) diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 16acbf8..d72fbfd 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -1,6 +1,7 @@ from appwrite.client import Client from appwrite.services.tables_db import TablesDB from appwrite.enums import RelationshipType +from appwrite.enums import RelationMutate client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index 1cb93db..560590e 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.tables_db import TablesDB +from appwrite.enums import RelationMutate client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md index 5b4c8f8..7722c62 100644 --- a/docs/examples/users/create-sha-user.md +++ b/docs/examples/users/create-sha-user.md @@ -1,5 +1,6 @@ from appwrite.client import Client from appwrite.services.users import Users +from appwrite.enums import PasswordHash client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint diff --git a/setup.py b/setup.py index a0c9da0..fc91917 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name = 'appwrite', packages = setuptools.find_packages(), - version = '13.6.1', + version = '13.7.0', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -18,7 +18,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/13.6.1.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/13.7.0.tar.gz', install_requires=[ 'requests', ], From 6e76cf285dc02adbde78cb2e02be53f5af9d2be8 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 28 Nov 2025 19:29:30 +0000 Subject: [PATCH 2/3] fix changelog --- CHANGELOG.md | 6 +++++- appwrite/client.py | 4 ++-- setup.py | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bae5dcc..ff2ac85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Change Log -## 13.7.0 +## 14.0.0 +* Rename `VCSDeploymentType` enum to `VCSReferenceType` +* Change `create_template_deployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters * Add `get_screenshot` method to `Avatars` service +* Add `Theme`, `Timezone` and `Output` enums +* Add support for dart39 and flutter335 runtimes ## 13.6.1 diff --git a/appwrite/client.py b/appwrite/client.py index 05d666d..cd05569 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -15,11 +15,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/13.7.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/14.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '13.7.0', + 'x-sdk-version': '14.0.0', 'X-Appwrite-Response-Format' : '1.8.0', } diff --git a/setup.py b/setup.py index fc91917..01a503e 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name = 'appwrite', packages = setuptools.find_packages(), - version = '13.7.0', + version = '14.0.0', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -18,7 +18,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/13.7.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/14.0.0.tar.gz', install_requires=[ 'requests', ], From 5af89500cea6ce03256841a7ba65ae9333b5bada Mon Sep 17 00:00:00 2001 From: root Date: Mon, 1 Dec 2025 13:55:06 +0000 Subject: [PATCH 3/3] update examples --- appwrite/services/account.py | 4 +-- docs/examples/avatars/get-screenshot.md | 35 ++++++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 242dd34..b7bf1e4 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -394,7 +394,7 @@ def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: If API request fails """ - api_path = '/account/mfa/challenge' + api_path = '/account/mfa/challenges' api_params = {} if factor is None: raise AppwriteException('Missing required parameter: "factor"') @@ -428,7 +428,7 @@ def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: If API request fails """ - api_path = '/account/mfa/challenge' + api_path = '/account/mfa/challenges' api_params = {} if challenge_id is None: raise AppwriteException('Missing required parameter: "challenge_id"') diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index fe7073e..4375594 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -13,23 +13,26 @@ avatars = Avatars(client) result = avatars.get_screenshot( url = 'https://example.com', - headers = {}, # optional - viewport_width = 1, # optional - viewport_height = 1, # optional - scale = 0.1, # optional + headers = { + "Authorization": "Bearer token123", + "X-Custom-Header": "value" + }, # optional + viewport_width = 1920, # optional + viewport_height = 1080, # optional + scale = 2, # optional theme = Theme.LIGHT, # optional - user_agent = '', # optional - fullpage = False, # optional - locale = '', # optional + user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', # optional + fullpage = True, # optional + locale = 'en-US', # optional timezone = Timezone.AFRICA_ABIDJAN, # optional - latitude = -90, # optional - longitude = -180, # optional - accuracy = 0, # optional - touch = False, # optional - permissions = [], # optional - sleep = 0, # optional - width = 0, # optional - height = 0, # optional - quality = -1, # optional + latitude = 37.7749, # optional + longitude = -122.4194, # optional + accuracy = 100, # optional + touch = True, # optional + permissions = ["geolocation","notifications"], # optional + sleep = 3, # optional + width = 800, # optional + height = 600, # optional + quality = 85, # optional output = Output.JPG # optional )