Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## 20.3.1

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

## 20.3.0

Expand Down
70 changes: 38 additions & 32 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,27 @@ Avatars avatars = Avatars(client);
// Downloading file
Uint8List bytes = await avatars.getScreenshot(
url: 'https://example.com',
headers: {}, // optional
viewportWidth: 1, // optional
viewportHeight: 1, // optional
scale: 0.1, // optional
headers: {
"Authorization": "Bearer token123",
"X-Custom-Header": "value"
}, // optional
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: Theme.light, // optional
userAgent: '<USER_AGENT>', // optional
fullpage: false, // optional
locale: '<LOCALE>', // optional
userAgent: '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.africaAbidjan, // 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
)

Expand All @@ -37,24 +40,27 @@ file.writeAsBytesSync(bytes);
FutureBuilder(
future: avatars.getScreenshot(
url:'https://example.com' ,
headers:{} , // optional
viewportWidth:1 , // optional
viewportHeight:1 , // optional
scale:0.1 , // optional
headers:{
"Authorization": "Bearer token123",
"X-Custom-Header": "value"
} , // optional
viewportWidth:1920 , // optional
viewportHeight:1080 , // optional
scale:2 , // optional
theme: Theme.light, // optional
userAgent:'<USER_AGENT>' , // optional
fullpage:false , // optional
locale:'<LOCALE>' , // optional
userAgent:'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.africaAbidjan, // 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
), // Works for both public file and private file, for private files you need to be logged in
builder: (context, snapshot) {
Expand Down
8 changes: 4 additions & 4 deletions lib/services/account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class Account extends Service {
'This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.')
Future<models.MfaChallenge> createMfaChallenge(
{required enums.AuthenticationFactor factor}) async {
const String apiPath = '/account/mfa/challenge';
const String apiPath = '/account/mfa/challenges';

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

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

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

final Map<String, dynamic> apiParams = {
'challengeId': challengeId,
Expand Down