Skip to content

Commit 8e39f05

Browse files
committed
fix: missing types for lists, and missing doc blocks
1 parent fdbd19f commit 8e39f05

12 files changed

+318
-55
lines changed

appwrite/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self):
1313
self._endpoint = 'https://cloud.appwrite.io/v1'
1414
self._global_headers = {
1515
'content-type': '',
16-
'user-agent' : 'AppwritePythonSDK/9.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
16+
'user-agent' : f'AppwritePythonSDK/9.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',

appwrite/services/account.py

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def __init__(self, client):
1010
super(Account, self).__init__(client)
1111

1212
def get(self):
13+
"""Get account"""
1314

1415
api_path = '/account'
1516
api_params = {}
@@ -19,6 +20,7 @@ def get(self):
1920
}, api_params)
2021

2122
def create(self, user_id: str, email: str, password: str, name: str = None):
23+
"""Create account"""
2224

2325
api_path = '/account'
2426
api_params = {}
@@ -42,6 +44,7 @@ def create(self, user_id: str, email: str, password: str, name: str = None):
4244
}, api_params)
4345

4446
def update_email(self, email: str, password: str):
47+
"""Update email"""
4548

4649
api_path = '/account/email'
4750
api_params = {}
@@ -59,7 +62,8 @@ def update_email(self, email: str, password: str):
5962
'content-type': 'application/json',
6063
}, api_params)
6164

62-
def list_identities(self, queries: list = None):
65+
def list_identities(self, queries: list[str] = None):
66+
"""List identities"""
6367

6468
api_path = '/account/identities'
6569
api_params = {}
@@ -71,6 +75,7 @@ def list_identities(self, queries: list = None):
7175
}, api_params)
7276

7377
def delete_identity(self, identity_id: str):
78+
"""Delete identity"""
7479

7580
api_path = '/account/identities/{identityId}'
7681
api_params = {}
@@ -85,6 +90,7 @@ def delete_identity(self, identity_id: str):
8590
}, api_params)
8691

8792
def create_jwt(self):
93+
"""Create JWT"""
8894

8995
api_path = '/account/jwts'
9096
api_params = {}
@@ -93,7 +99,8 @@ def create_jwt(self):
9399
'content-type': 'application/json',
94100
}, api_params)
95101

96-
def list_logs(self, queries: list = None):
102+
def list_logs(self, queries: list[str] = None):
103+
"""List logs"""
97104

98105
api_path = '/account/logs'
99106
api_params = {}
@@ -105,6 +112,7 @@ def list_logs(self, queries: list = None):
105112
}, api_params)
106113

107114
def update_mfa(self, mfa: bool):
115+
"""Update MFA"""
108116

109117
api_path = '/account/mfa'
110118
api_params = {}
@@ -119,6 +127,7 @@ def update_mfa(self, mfa: bool):
119127
}, api_params)
120128

121129
def create_mfa_authenticator(self, type: AuthenticatorType):
130+
"""Create authenticator"""
122131

123132
api_path = '/account/mfa/authenticators/{type}'
124133
api_params = {}
@@ -133,6 +142,7 @@ def create_mfa_authenticator(self, type: AuthenticatorType):
133142
}, api_params)
134143

135144
def update_mfa_authenticator(self, type: AuthenticatorType, otp: str):
145+
"""Verify authenticator"""
136146

137147
api_path = '/account/mfa/authenticators/{type}'
138148
api_params = {}
@@ -151,6 +161,7 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str):
151161
}, api_params)
152162

153163
def delete_mfa_authenticator(self, type: AuthenticatorType):
164+
"""Delete authenticator"""
154165

155166
api_path = '/account/mfa/authenticators/{type}'
156167
api_params = {}
@@ -165,6 +176,7 @@ def delete_mfa_authenticator(self, type: AuthenticatorType):
165176
}, api_params)
166177

167178
def create_mfa_challenge(self, factor: AuthenticationFactor):
179+
"""Create MFA challenge"""
168180

169181
api_path = '/account/mfa/challenge'
170182
api_params = {}
@@ -179,6 +191,7 @@ def create_mfa_challenge(self, factor: AuthenticationFactor):
179191
}, api_params)
180192

181193
def update_mfa_challenge(self, challenge_id: str, otp: str):
194+
"""Create MFA challenge (confirmation)"""
182195

183196
api_path = '/account/mfa/challenge'
184197
api_params = {}
@@ -197,6 +210,7 @@ def update_mfa_challenge(self, challenge_id: str, otp: str):
197210
}, api_params)
198211

199212
def list_mfa_factors(self):
213+
"""List factors"""
200214

201215
api_path = '/account/mfa/factors'
202216
api_params = {}
@@ -206,6 +220,7 @@ def list_mfa_factors(self):
206220
}, api_params)
207221

208222
def get_mfa_recovery_codes(self):
223+
"""Get MFA recovery codes"""
209224

210225
api_path = '/account/mfa/recovery-codes'
211226
api_params = {}
@@ -215,6 +230,7 @@ def get_mfa_recovery_codes(self):
215230
}, api_params)
216231

217232
def create_mfa_recovery_codes(self):
233+
"""Create MFA recovery codes"""
218234

219235
api_path = '/account/mfa/recovery-codes'
220236
api_params = {}
@@ -224,6 +240,7 @@ def create_mfa_recovery_codes(self):
224240
}, api_params)
225241

226242
def update_mfa_recovery_codes(self):
243+
"""Regenerate MFA recovery codes"""
227244

228245
api_path = '/account/mfa/recovery-codes'
229246
api_params = {}
@@ -233,6 +250,7 @@ def update_mfa_recovery_codes(self):
233250
}, api_params)
234251

235252
def update_name(self, name: str):
253+
"""Update name"""
236254

237255
api_path = '/account/name'
238256
api_params = {}
@@ -247,6 +265,7 @@ def update_name(self, name: str):
247265
}, api_params)
248266

249267
def update_password(self, password: str, old_password: str = None):
268+
"""Update password"""
250269

251270
api_path = '/account/password'
252271
api_params = {}
@@ -262,6 +281,7 @@ def update_password(self, password: str, old_password: str = None):
262281
}, api_params)
263282

264283
def update_phone(self, phone: str, password: str):
284+
"""Update phone"""
265285

266286
api_path = '/account/phone'
267287
api_params = {}
@@ -280,6 +300,7 @@ def update_phone(self, phone: str, password: str):
280300
}, api_params)
281301

282302
def get_prefs(self):
303+
"""Get account preferences"""
283304

284305
api_path = '/account/prefs'
285306
api_params = {}
@@ -289,6 +310,7 @@ def get_prefs(self):
289310
}, api_params)
290311

291312
def update_prefs(self, prefs: dict):
313+
"""Update preferences"""
292314

293315
api_path = '/account/prefs'
294316
api_params = {}
@@ -303,6 +325,7 @@ def update_prefs(self, prefs: dict):
303325
}, api_params)
304326

305327
def create_recovery(self, email: str, url: str):
328+
"""Create password recovery"""
306329

307330
api_path = '/account/recovery'
308331
api_params = {}
@@ -321,6 +344,7 @@ def create_recovery(self, email: str, url: str):
321344
}, api_params)
322345

323346
def update_recovery(self, user_id: str, secret: str, password: str):
347+
"""Create password recovery (confirmation)"""
324348

325349
api_path = '/account/recovery'
326350
api_params = {}
@@ -343,6 +367,7 @@ def update_recovery(self, user_id: str, secret: str, password: str):
343367
}, api_params)
344368

345369
def list_sessions(self):
370+
"""List sessions"""
346371

347372
api_path = '/account/sessions'
348373
api_params = {}
@@ -352,6 +377,7 @@ def list_sessions(self):
352377
}, api_params)
353378

354379
def delete_sessions(self):
380+
"""Delete sessions"""
355381

356382
api_path = '/account/sessions'
357383
api_params = {}
@@ -361,6 +387,7 @@ def delete_sessions(self):
361387
}, api_params)
362388

363389
def create_anonymous_session(self):
390+
"""Create anonymous session"""
364391

365392
api_path = '/account/sessions/anonymous'
366393
api_params = {}
@@ -370,6 +397,7 @@ def create_anonymous_session(self):
370397
}, api_params)
371398

372399
def create_email_password_session(self, email: str, password: str):
400+
"""Create email password session"""
373401

374402
api_path = '/account/sessions/email'
375403
api_params = {}
@@ -388,6 +416,7 @@ def create_email_password_session(self, email: str, password: str):
388416
}, api_params)
389417

390418
def update_magic_url_session(self, user_id: str, secret: str):
419+
"""Update magic URL session"""
391420

392421
api_path = '/account/sessions/magic-url'
393422
api_params = {}
@@ -406,6 +435,7 @@ def update_magic_url_session(self, user_id: str, secret: str):
406435
}, api_params)
407436

408437
def update_phone_session(self, user_id: str, secret: str):
438+
"""Update phone session"""
409439

410440
api_path = '/account/sessions/phone'
411441
api_params = {}
@@ -424,6 +454,7 @@ def update_phone_session(self, user_id: str, secret: str):
424454
}, api_params)
425455

426456
def create_session(self, user_id: str, secret: str):
457+
"""Create session"""
427458

428459
api_path = '/account/sessions/token'
429460
api_params = {}
@@ -442,6 +473,7 @@ def create_session(self, user_id: str, secret: str):
442473
}, api_params)
443474

444475
def get_session(self, session_id: str):
476+
"""Get session"""
445477

446478
api_path = '/account/sessions/{sessionId}'
447479
api_params = {}
@@ -456,6 +488,7 @@ def get_session(self, session_id: str):
456488
}, api_params)
457489

458490
def update_session(self, session_id: str):
491+
"""Update session"""
459492

460493
api_path = '/account/sessions/{sessionId}'
461494
api_params = {}
@@ -470,6 +503,7 @@ def update_session(self, session_id: str):
470503
}, api_params)
471504

472505
def delete_session(self, session_id: str):
506+
"""Delete session"""
473507

474508
api_path = '/account/sessions/{sessionId}'
475509
api_params = {}
@@ -484,6 +518,7 @@ def delete_session(self, session_id: str):
484518
}, api_params)
485519

486520
def update_status(self):
521+
"""Update status"""
487522

488523
api_path = '/account/status'
489524
api_params = {}
@@ -493,6 +528,7 @@ def update_status(self):
493528
}, api_params)
494529

495530
def create_email_token(self, user_id: str, email: str, phrase: bool = None):
531+
"""Create email token (OTP)"""
496532

497533
api_path = '/account/tokens/email'
498534
api_params = {}
@@ -512,6 +548,7 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None):
512548
}, api_params)
513549

514550
def create_magic_url_token(self, user_id: str, email: str, url: str = None, phrase: bool = None):
551+
"""Create magic URL token"""
515552

516553
api_path = '/account/tokens/magic-url'
517554
api_params = {}
@@ -531,7 +568,8 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra
531568
'content-type': 'application/json',
532569
}, api_params)
533570

534-
def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: list = None):
571+
def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: list[str] = None):
572+
"""Create OAuth2 token"""
535573

536574
api_path = '/account/tokens/oauth2/{provider}'
537575
api_params = {}
@@ -549,6 +587,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai
549587
}, api_params, response_type='location')
550588

551589
def create_phone_token(self, user_id: str, phone: str):
590+
"""Create phone token"""
552591

553592
api_path = '/account/tokens/phone'
554593
api_params = {}
@@ -567,6 +606,7 @@ def create_phone_token(self, user_id: str, phone: str):
567606
}, api_params)
568607

569608
def create_verification(self, url: str):
609+
"""Create email verification"""
570610

571611
api_path = '/account/verification'
572612
api_params = {}
@@ -581,6 +621,7 @@ def create_verification(self, url: str):
581621
}, api_params)
582622

583623
def update_verification(self, user_id: str, secret: str):
624+
"""Create email verification (confirmation)"""
584625

585626
api_path = '/account/verification'
586627
api_params = {}
@@ -599,6 +640,7 @@ def update_verification(self, user_id: str, secret: str):
599640
}, api_params)
600641

601642
def create_phone_verification(self):
643+
"""Create phone verification"""
602644

603645
api_path = '/account/verification/phone'
604646
api_params = {}
@@ -608,6 +650,7 @@ def create_phone_verification(self):
608650
}, api_params)
609651

610652
def update_phone_verification(self, user_id: str, secret: str):
653+
"""Update phone verification (confirmation)"""
611654

612655
api_path = '/account/verification/phone'
613656
api_params = {}

0 commit comments

Comments
 (0)