Skip to content

Commit c2b5cf8

Browse files
authored
Merge pull request #290 from appwrite/dev
feat: Flutter SDK update for version 20.3.2
2 parents 948b14b + fefb9fd commit c2b5cf8

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
## 20.3.1
88

99
* Fix passing of `null` values and stripping only non-nullable optional parameters from the request body
10+
* Add `getScreenshot` method to `Avatars` service
11+
* Add `Theme`, `Timezone` and `Output` enums
1012

1113
## 20.3.0
1214

docs/examples/avatars/get-screenshot.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@ Avatars avatars = Avatars(client);
99
// Downloading file
1010
Uint8List bytes = await avatars.getScreenshot(
1111
url: 'https://example.com',
12-
headers: {}, // optional
13-
viewportWidth: 1, // optional
14-
viewportHeight: 1, // optional
15-
scale: 0.1, // optional
12+
headers: {
13+
"Authorization": "Bearer token123",
14+
"X-Custom-Header": "value"
15+
}, // optional
16+
viewportWidth: 1920, // optional
17+
viewportHeight: 1080, // optional
18+
scale: 2, // optional
1619
theme: Theme.light, // optional
17-
userAgent: '<USER_AGENT>', // optional
18-
fullpage: false, // optional
19-
locale: '<LOCALE>', // optional
20+
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
21+
fullpage: true, // optional
22+
locale: 'en-US', // optional
2023
timezone: Timezone.africaAbidjan, // optional
21-
latitude: -90, // optional
22-
longitude: -180, // optional
23-
accuracy: 0, // optional
24-
touch: false, // optional
25-
permissions: [], // optional
26-
sleep: 0, // optional
27-
width: 0, // optional
28-
height: 0, // optional
29-
quality: -1, // optional
24+
latitude: 37.7749, // optional
25+
longitude: -122.4194, // optional
26+
accuracy: 100, // optional
27+
touch: true, // optional
28+
permissions: ["geolocation","notifications"], // optional
29+
sleep: 3, // optional
30+
width: 800, // optional
31+
height: 600, // optional
32+
quality: 85, // optional
3033
output: Output.jpg, // optional
3134
)
3235

@@ -37,24 +40,27 @@ file.writeAsBytesSync(bytes);
3740
FutureBuilder(
3841
future: avatars.getScreenshot(
3942
url:'https://example.com' ,
40-
headers:{} , // optional
41-
viewportWidth:1 , // optional
42-
viewportHeight:1 , // optional
43-
scale:0.1 , // optional
43+
headers:{
44+
"Authorization": "Bearer token123",
45+
"X-Custom-Header": "value"
46+
} , // optional
47+
viewportWidth:1920 , // optional
48+
viewportHeight:1080 , // optional
49+
scale:2 , // optional
4450
theme: Theme.light, // optional
45-
userAgent:'<USER_AGENT>' , // optional
46-
fullpage:false , // optional
47-
locale:'<LOCALE>' , // optional
51+
userAgent:'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15' , // optional
52+
fullpage:true , // optional
53+
locale:'en-US' , // optional
4854
timezone: Timezone.africaAbidjan, // optional
49-
latitude:-90 , // optional
50-
longitude:-180 , // optional
51-
accuracy:0 , // optional
52-
touch:false , // optional
53-
permissions:[] , // optional
54-
sleep:0 , // optional
55-
width:0 , // optional
56-
height:0 , // optional
57-
quality:-1 , // optional
55+
latitude:37.7749 , // optional
56+
longitude:-122.4194 , // optional
57+
accuracy:100 , // optional
58+
touch:true , // optional
59+
permissions:["geolocation","notifications"] , // optional
60+
sleep:3 , // optional
61+
width:800 , // optional
62+
height:600 , // optional
63+
quality:85 , // optional
5864
output: Output.jpg, // optional
5965
), // Works for both public file and private file, for private files you need to be logged in
6066
builder: (context, snapshot) {

lib/services/account.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class Account extends Service {
301301
'This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.')
302302
Future<models.MfaChallenge> createMfaChallenge(
303303
{required enums.AuthenticationFactor factor}) async {
304-
const String apiPath = '/account/mfa/challenge';
304+
const String apiPath = '/account/mfa/challenges';
305305

306306
final Map<String, dynamic> apiParams = {
307307
'factor': factor.value,
@@ -322,7 +322,7 @@ class Account extends Service {
322322
/// method.
323323
Future<models.MfaChallenge> createMFAChallenge(
324324
{required enums.AuthenticationFactor factor}) async {
325-
const String apiPath = '/account/mfa/challenge';
325+
const String apiPath = '/account/mfa/challenges';
326326

327327
final Map<String, dynamic> apiParams = {
328328
'factor': factor.value,
@@ -347,7 +347,7 @@ class Account extends Service {
347347
'This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.')
348348
Future<models.Session> updateMfaChallenge(
349349
{required String challengeId, required String otp}) async {
350-
const String apiPath = '/account/mfa/challenge';
350+
const String apiPath = '/account/mfa/challenges';
351351

352352
final Map<String, dynamic> apiParams = {
353353
'challengeId': challengeId,
@@ -371,7 +371,7 @@ class Account extends Service {
371371
/// method.
372372
Future<models.Session> updateMFAChallenge(
373373
{required String challengeId, required String otp}) async {
374-
const String apiPath = '/account/mfa/challenge';
374+
const String apiPath = '/account/mfa/challenges';
375375

376376
final Map<String, dynamic> apiParams = {
377377
'challengeId': challengeId,

0 commit comments

Comments
 (0)