Skip to content

Commit d9de0e4

Browse files
committed
Add update attribute parameters
1 parent 13fbe66 commit d9de0e4

File tree

272 files changed

+638
-489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+638
-489
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite Python SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

9-
**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
9+
**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
1010

1111
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1212

appwrite/client.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ def __init__(self):
1313
self._endpoint = 'https://cloud.appwrite.io/v1'
1414
self._global_headers = {
1515
'content-type': '',
16-
'user-agent' : 'AppwritePythonSDK/5.0.3 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
16+
'user-agent' : 'AppwritePythonSDK/6.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
1717
'x-sdk-name': 'Python',
1818
'x-sdk-platform': 'server',
1919
'x-sdk-language': 'python',
20-
'x-sdk-version': '5.0.3',
21-
'X-Appwrite-Response-Format' : '1.5.0',
20+
'x-sdk-version': '6.0.0',
21+
'X-Appwrite-Response-Format' : '1.6.0',
2222
}
2323

2424
def set_self_signed(self, status=True):
@@ -113,6 +113,11 @@ def call(self, method, path='', headers=None, params=None, response_type='json')
113113

114114
response.raise_for_status()
115115

116+
warnings = response.headers.get('x-appwrite-warning')
117+
if warnings:
118+
for warning in warnings.split(';'):
119+
print(f'Warning: {warning}')
120+
116121
content_type = response.headers['Content-Type']
117122

118123
if response_type == 'location':

appwrite/enums/name.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Name(Enum):
88
V1_FUNCTIONS = "v1-functions"
99
V1_USAGE = "v1-usage"
1010
V1_USAGE_DUMP = "v1-usage-dump"
11-
WEBHOOKSV1 = "webhooksv1"
11+
V1_WEBHOOKS = "v1-webhooks"
1212
V1_CERTIFICATES = "v1-certificates"
1313
V1_BUILDS = "v1-builds"
1414
V1_MESSAGING = "v1-messaging"

appwrite/enums/runtime.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ class Runtime(Enum):
4646
CPP_17 = "cpp-17"
4747
CPP_20 = "cpp-20"
4848
BUN_1_0 = "bun-1.0"
49+
GO_1_23 = "go-1.23"

appwrite/services/account.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def create_jwt(self):
9595
"""Create JWT"""
9696

9797

98-
api_path = '/account/jwt'
98+
api_path = '/account/jwts'
9999
api_params = {}
100100

101101
return self.client.call('post', api_path, {
@@ -132,7 +132,7 @@ def update_mfa(self, mfa):
132132
}, api_params)
133133

134134
def create_mfa_authenticator(self, type):
135-
"""Add Authenticator"""
135+
"""Create Authenticator"""
136136

137137

138138
api_path = '/account/mfa/authenticators/{type}'
@@ -167,7 +167,7 @@ def update_mfa_authenticator(self, type, otp):
167167
'content-type': 'application/json',
168168
}, api_params)
169169

170-
def delete_mfa_authenticator(self, type, otp):
170+
def delete_mfa_authenticator(self, type):
171171
"""Delete Authenticator"""
172172

173173

@@ -176,19 +176,15 @@ def delete_mfa_authenticator(self, type, otp):
176176
if type is None:
177177
raise AppwriteException('Missing required parameter: "type"')
178178

179-
if otp is None:
180-
raise AppwriteException('Missing required parameter: "otp"')
181-
182179
api_path = api_path.replace('{type}', type)
183180

184-
api_params['otp'] = otp
185181

186182
return self.client.call('delete', api_path, {
187183
'content-type': 'application/json',
188184
}, api_params)
189185

190186
def create_mfa_challenge(self, factor):
191-
"""Create 2FA Challenge"""
187+
"""Create MFA Challenge"""
192188

193189

194190
api_path = '/account/mfa/challenge'
@@ -693,7 +689,7 @@ def create_phone_verification(self):
693689
}, api_params)
694690

695691
def update_phone_verification(self, user_id, secret):
696-
"""Create phone verification (confirmation)"""
692+
"""Update phone verification (confirmation)"""
697693

698694

699695
api_path = '/account/verification/phone'

appwrite/services/databases.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def create_boolean_attribute(self, database_id, collection_id, key, required, de
257257
'content-type': 'application/json',
258258
}, api_params)
259259

260-
def update_boolean_attribute(self, database_id, collection_id, key, required, default):
260+
def update_boolean_attribute(self, database_id, collection_id, key, required, default, new_key = None):
261261
"""Update boolean attribute"""
262262

263263

@@ -281,6 +281,7 @@ def update_boolean_attribute(self, database_id, collection_id, key, required, de
281281

282282
api_params['required'] = required
283283
api_params['default'] = default
284+
api_params['newKey'] = new_key
284285

285286
return self.client.call('patch', api_path, {
286287
'content-type': 'application/json',
@@ -316,7 +317,7 @@ def create_datetime_attribute(self, database_id, collection_id, key, required, d
316317
'content-type': 'application/json',
317318
}, api_params)
318319

319-
def update_datetime_attribute(self, database_id, collection_id, key, required, default):
320+
def update_datetime_attribute(self, database_id, collection_id, key, required, default, new_key = None):
320321
"""Update dateTime attribute"""
321322

322323

@@ -340,6 +341,7 @@ def update_datetime_attribute(self, database_id, collection_id, key, required, d
340341

341342
api_params['required'] = required
342343
api_params['default'] = default
344+
api_params['newKey'] = new_key
343345

344346
return self.client.call('patch', api_path, {
345347
'content-type': 'application/json',
@@ -375,7 +377,7 @@ def create_email_attribute(self, database_id, collection_id, key, required, defa
375377
'content-type': 'application/json',
376378
}, api_params)
377379

378-
def update_email_attribute(self, database_id, collection_id, key, required, default):
380+
def update_email_attribute(self, database_id, collection_id, key, required, default, new_key = None):
379381
"""Update email attribute"""
380382

381383

@@ -399,6 +401,7 @@ def update_email_attribute(self, database_id, collection_id, key, required, defa
399401

400402
api_params['required'] = required
401403
api_params['default'] = default
404+
api_params['newKey'] = new_key
402405

403406
return self.client.call('patch', api_path, {
404407
'content-type': 'application/json',
@@ -438,7 +441,7 @@ def create_enum_attribute(self, database_id, collection_id, key, elements, requi
438441
'content-type': 'application/json',
439442
}, api_params)
440443

441-
def update_enum_attribute(self, database_id, collection_id, key, elements, required, default):
444+
def update_enum_attribute(self, database_id, collection_id, key, elements, required, default, new_key = None):
442445
"""Update enum attribute"""
443446

444447

@@ -466,6 +469,7 @@ def update_enum_attribute(self, database_id, collection_id, key, elements, requi
466469
api_params['elements'] = elements
467470
api_params['required'] = required
468471
api_params['default'] = default
472+
api_params['newKey'] = new_key
469473

470474
return self.client.call('patch', api_path, {
471475
'content-type': 'application/json',
@@ -503,7 +507,7 @@ def create_float_attribute(self, database_id, collection_id, key, required, min
503507
'content-type': 'application/json',
504508
}, api_params)
505509

506-
def update_float_attribute(self, database_id, collection_id, key, required, min, max, default):
510+
def update_float_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None):
507511
"""Update float attribute"""
508512

509513

@@ -535,6 +539,7 @@ def update_float_attribute(self, database_id, collection_id, key, required, min,
535539
api_params['min'] = min
536540
api_params['max'] = max
537541
api_params['default'] = default
542+
api_params['newKey'] = new_key
538543

539544
return self.client.call('patch', api_path, {
540545
'content-type': 'application/json',
@@ -572,7 +577,7 @@ def create_integer_attribute(self, database_id, collection_id, key, required, mi
572577
'content-type': 'application/json',
573578
}, api_params)
574579

575-
def update_integer_attribute(self, database_id, collection_id, key, required, min, max, default):
580+
def update_integer_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None):
576581
"""Update integer attribute"""
577582

578583

@@ -604,6 +609,7 @@ def update_integer_attribute(self, database_id, collection_id, key, required, mi
604609
api_params['min'] = min
605610
api_params['max'] = max
606611
api_params['default'] = default
612+
api_params['newKey'] = new_key
607613

608614
return self.client.call('patch', api_path, {
609615
'content-type': 'application/json',
@@ -639,7 +645,7 @@ def create_ip_attribute(self, database_id, collection_id, key, required, default
639645
'content-type': 'application/json',
640646
}, api_params)
641647

642-
def update_ip_attribute(self, database_id, collection_id, key, required, default):
648+
def update_ip_attribute(self, database_id, collection_id, key, required, default, new_key = None):
643649
"""Update IP address attribute"""
644650

645651

@@ -663,6 +669,7 @@ def update_ip_attribute(self, database_id, collection_id, key, required, default
663669

664670
api_params['required'] = required
665671
api_params['default'] = default
672+
api_params['newKey'] = new_key
666673

667674
return self.client.call('patch', api_path, {
668675
'content-type': 'application/json',
@@ -735,7 +742,7 @@ def create_string_attribute(self, database_id, collection_id, key, size, require
735742
'content-type': 'application/json',
736743
}, api_params)
737744

738-
def update_string_attribute(self, database_id, collection_id, key, required, default):
745+
def update_string_attribute(self, database_id, collection_id, key, required, default, size = None, new_key = None):
739746
"""Update string attribute"""
740747

741748

@@ -759,6 +766,8 @@ def update_string_attribute(self, database_id, collection_id, key, required, def
759766

760767
api_params['required'] = required
761768
api_params['default'] = default
769+
api_params['size'] = size
770+
api_params['newKey'] = new_key
762771

763772
return self.client.call('patch', api_path, {
764773
'content-type': 'application/json',
@@ -794,7 +803,7 @@ def create_url_attribute(self, database_id, collection_id, key, required, defaul
794803
'content-type': 'application/json',
795804
}, api_params)
796805

797-
def update_url_attribute(self, database_id, collection_id, key, required, default):
806+
def update_url_attribute(self, database_id, collection_id, key, required, default, new_key = None):
798807
"""Update URL attribute"""
799808

800809

@@ -818,6 +827,7 @@ def update_url_attribute(self, database_id, collection_id, key, required, defaul
818827

819828
api_params['required'] = required
820829
api_params['default'] = default
830+
api_params['newKey'] = new_key
821831

822832
return self.client.call('patch', api_path, {
823833
'content-type': 'application/json',
@@ -871,7 +881,7 @@ def delete_attribute(self, database_id, collection_id, key):
871881
'content-type': 'application/json',
872882
}, api_params)
873883

874-
def update_relationship_attribute(self, database_id, collection_id, key, on_delete = None):
884+
def update_relationship_attribute(self, database_id, collection_id, key, on_delete = None, new_key = None):
875885
"""Update relationship attribute"""
876886

877887

@@ -891,6 +901,7 @@ def update_relationship_attribute(self, database_id, collection_id, key, on_dele
891901
api_path = api_path.replace('{key}', key)
892902

893903
api_params['onDelete'] = on_delete
904+
api_params['newKey'] = new_key
894905

895906
return self.client.call('patch', api_path, {
896907
'content-type': 'application/json',

0 commit comments

Comments
 (0)