Skip to content

Commit 6770a33

Browse files
committed
fix: typing to be bytes
1 parent a09439f commit 6770a33

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

appwrite/services/avatars.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Avatars(Service):
1010
def __init__(self, client) -> None:
1111
super(Avatars, self).__init__(client)
1212

13-
def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None) -> str:
13+
def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None) -> bytes:
1414
"""
1515
You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
1616
@@ -29,8 +29,8 @@ def get_browser(self, code: Browser, width: float = None, height: float = None,
2929
3030
Returns
3131
-------
32-
str
33-
Response as a string
32+
bytes
33+
Response as bytes
3434
3535
Raises
3636
------
@@ -53,7 +53,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None,
5353
'content-type': 'application/json',
5454
}, api_params)
5555

56-
def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> str:
56+
def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> bytes:
5757
"""
5858
The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
5959
@@ -73,8 +73,8 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float =
7373
7474
Returns
7575
-------
76-
str
77-
Response as a string
76+
bytes
77+
Response as bytes
7878
7979
Raises
8080
------
@@ -97,7 +97,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float =
9797
'content-type': 'application/json',
9898
}, api_params)
9999

100-
def get_favicon(self, url: str) -> str:
100+
def get_favicon(self, url: str) -> bytes:
101101
"""
102102
Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
103103
@@ -110,8 +110,8 @@ def get_favicon(self, url: str) -> str:
110110
111111
Returns
112112
-------
113-
str
114-
Response as a string
113+
bytes
114+
Response as bytes
115115
116116
Raises
117117
------
@@ -131,7 +131,7 @@ def get_favicon(self, url: str) -> str:
131131
'content-type': 'application/json',
132132
}, api_params)
133133

134-
def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> str:
134+
def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> bytes:
135135
"""
136136
You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
137137
@@ -151,8 +151,8 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit
151151
152152
Returns
153153
-------
154-
str
155-
Response as a string
154+
bytes
155+
Response as bytes
156156
157157
Raises
158158
------
@@ -175,7 +175,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit
175175
'content-type': 'application/json',
176176
}, api_params)
177177

178-
def get_image(self, url: str, width: float = None, height: float = None) -> str:
178+
def get_image(self, url: str, width: float = None, height: float = None) -> bytes:
179179
"""
180180
Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
181181
@@ -194,8 +194,8 @@ def get_image(self, url: str, width: float = None, height: float = None) -> str:
194194
195195
Returns
196196
-------
197-
str
198-
Response as a string
197+
bytes
198+
Response as bytes
199199
200200
Raises
201201
------
@@ -217,7 +217,7 @@ def get_image(self, url: str, width: float = None, height: float = None) -> str:
217217
'content-type': 'application/json',
218218
}, api_params)
219219

220-
def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> str:
220+
def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> bytes:
221221
"""
222222
Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
223223
@@ -239,8 +239,8 @@ def get_initials(self, name: str = None, width: float = None, height: float = No
239239
240240
Returns
241241
-------
242-
str
243-
Response as a string
242+
bytes
243+
Response as bytes
244244
245245
Raises
246246
------
@@ -260,7 +260,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No
260260
'content-type': 'application/json',
261261
}, api_params)
262262

263-
def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> str:
263+
def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> bytes:
264264
"""
265265
Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
266266
@@ -278,8 +278,8 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download:
278278
279279
Returns
280280
-------
281-
str
282-
Response as a string
281+
bytes
282+
Response as bytes
283283
284284
Raises
285285
------

appwrite/services/functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[
630630
'content-type': 'application/json',
631631
}, api_params)
632632

633-
def get_deployment_download(self, function_id: str, deployment_id: str) -> str:
633+
def get_deployment_download(self, function_id: str, deployment_id: str) -> bytes:
634634
"""
635635
Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download.
636636
@@ -643,8 +643,8 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> str:
643643
644644
Returns
645645
-------
646-
str
647-
Response as a string
646+
bytes
647+
Response as bytes
648648
649649
Raises
650650
------

appwrite/services/storage.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]:
451451
'content-type': 'application/json',
452452
}, api_params)
453453

454-
def get_file_download(self, bucket_id: str, file_id: str) -> str:
454+
def get_file_download(self, bucket_id: str, file_id: str) -> bytes:
455455
"""
456456
Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
457457
@@ -464,8 +464,8 @@ def get_file_download(self, bucket_id: str, file_id: str) -> str:
464464
465465
Returns
466466
-------
467-
str
468-
Response as a string
467+
bytes
468+
Response as bytes
469469
470470
Raises
471471
------
@@ -489,7 +489,7 @@ def get_file_download(self, bucket_id: str, file_id: str) -> str:
489489
'content-type': 'application/json',
490490
}, api_params)
491491

492-
def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, height: float = None, gravity: ImageGravity = None, quality: float = None, border_width: float = None, border_color: str = None, border_radius: float = None, opacity: float = None, rotation: float = None, background: str = None, output: ImageFormat = None) -> str:
492+
def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, height: float = None, gravity: ImageGravity = None, quality: float = None, border_width: float = None, border_color: str = None, border_radius: float = None, opacity: float = None, rotation: float = None, background: str = None, output: ImageFormat = None) -> bytes:
493493
"""
494494
Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
495495
@@ -524,8 +524,8 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he
524524
525525
Returns
526526
-------
527-
str
528-
Response as a string
527+
bytes
528+
Response as bytes
529529
530530
Raises
531531
------
@@ -560,7 +560,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he
560560
'content-type': 'application/json',
561561
}, api_params)
562562

563-
def get_file_view(self, bucket_id: str, file_id: str) -> str:
563+
def get_file_view(self, bucket_id: str, file_id: str) -> bytes:
564564
"""
565565
Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
566566
@@ -573,8 +573,8 @@ def get_file_view(self, bucket_id: str, file_id: str) -> str:
573573
574574
Returns
575575
-------
576-
str
577-
Response as a string
576+
bytes
577+
Response as bytes
578578
579579
Raises
580580
------

0 commit comments

Comments
 (0)