mirror of
https://github.com/appwrite/sdk-for-flutter.git
synced 2026-04-07 19:27:41 +00:00
chore: bug fixes and improvements
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
[](https://twitter.com/appwrite)
|
||||
[](https://appwrite.io/discord)
|
||||
|
||||
**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
|
||||
**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
|
||||
|
||||
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 Flutter 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)
|
||||
|
||||
@@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:
|
||||
|
||||
```yml
|
||||
dependencies:
|
||||
appwrite: ^12.0.0-rc.1
|
||||
appwrite: ^11.0.1
|
||||
```
|
||||
|
||||
You can install packages from the command line:
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createEmailPasswordSession(
|
||||
email:'email@example.com' ,
|
||||
password:'password' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
+3
-3
@@ -8,9 +8,9 @@ void main() { // Init SDK
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createMagicURLToken(
|
||||
userId:'[USER_ID]' ,
|
||||
email:'email@example.com' ,
|
||||
Future result = account.createEmailSession(
|
||||
email: 'email@example.com',
|
||||
password: 'password',
|
||||
);
|
||||
|
||||
result
|
||||
+3
-3
@@ -8,9 +8,9 @@ void main() { // Init SDK
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createEmailToken(
|
||||
userId:'[USER_ID]' ,
|
||||
email:'email@example.com' ,
|
||||
Future result = account.createMagicURLSession(
|
||||
userId: '[USER_ID]',
|
||||
email: 'email@example.com',
|
||||
);
|
||||
|
||||
result
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createOAuth2Session(
|
||||
provider: OAuthProvider.amazon.value,
|
||||
provider: 'amazon',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
+3
-2
@@ -8,8 +8,9 @@ void main() { // Init SDK
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createChallenge(
|
||||
provider: AuthenticatorProvider.totp.value,
|
||||
Future result = account.createPhoneSession(
|
||||
userId: '[USER_ID]',
|
||||
phone: '+12065550100',
|
||||
);
|
||||
|
||||
result
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createPhoneToken(
|
||||
userId:'[USER_ID]' ,
|
||||
phone:'+12065550100' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createPushTarget(
|
||||
targetId:'[TARGET_ID]' ,
|
||||
identifier:'[IDENTIFIER]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createRecovery(
|
||||
email:'email@example.com' ,
|
||||
url:'https://example.com' ,
|
||||
email: 'email@example.com',
|
||||
url: 'https://example.com',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createSession(
|
||||
userId:'[USER_ID]' ,
|
||||
secret:'[SECRET]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.createVerification(
|
||||
url:'https://example.com' ,
|
||||
url: 'https://example.com',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,9 +9,9 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.create(
|
||||
userId:'[USER_ID]' ,
|
||||
email:'email@example.com' ,
|
||||
password:'' ,
|
||||
userId: '[USER_ID]',
|
||||
email: 'email@example.com',
|
||||
password: '',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.deleteAuthenticator(
|
||||
provider: AuthenticatorProvider.totp.value,
|
||||
otp:'[OTP]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.deleteIdentity(
|
||||
identityId:'[IDENTITY_ID]' ,
|
||||
identityId: '[IDENTITY_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.deletePushTarget(
|
||||
targetId:'[TARGET_ID]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.deleteSession(
|
||||
sessionId:'[SESSION_ID]' ,
|
||||
sessionId: '[SESSION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.getSession(
|
||||
sessionId:'[SESSION_ID]' ,
|
||||
sessionId: '[SESSION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.listFactors();
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateChallenge(
|
||||
challengeId:'[CHALLENGE_ID]' ,
|
||||
otp:'[OTP]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateEmail(
|
||||
email:'email@example.com' ,
|
||||
password:'password' ,
|
||||
email: 'email@example.com',
|
||||
password: 'password',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateMFA(
|
||||
mfa:false ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateMagicURLSession(
|
||||
userId:'[USER_ID]' ,
|
||||
secret:'[SECRET]' ,
|
||||
userId: '[USER_ID]',
|
||||
secret: '[SECRET]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateName(
|
||||
name:'[NAME]' ,
|
||||
name: '[NAME]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updatePassword(
|
||||
password:'' ,
|
||||
password: '',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
+3
-2
@@ -8,8 +8,9 @@ void main() { // Init SDK
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.addAuthenticator(
|
||||
factor: AuthenticatorFactor.totp.value,
|
||||
Future result = account.updatePhoneSession(
|
||||
userId: '[USER_ID]',
|
||||
secret: '[SECRET]',
|
||||
);
|
||||
|
||||
result
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updatePhoneVerification(
|
||||
userId:'[USER_ID]' ,
|
||||
secret:'[SECRET]' ,
|
||||
userId: '[USER_ID]',
|
||||
secret: '[SECRET]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updatePhone(
|
||||
phone:'+12065550100' ,
|
||||
password:'password' ,
|
||||
phone: '+12065550100',
|
||||
password: 'password',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updatePrefs(
|
||||
prefs:{} ,
|
||||
prefs: {},
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updatePushTarget(
|
||||
targetId:'[TARGET_ID]' ,
|
||||
identifier:'[IDENTIFIER]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -9,9 +9,10 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateRecovery(
|
||||
userId:'[USER_ID]' ,
|
||||
secret:'[SECRET]' ,
|
||||
password:'' ,
|
||||
userId: '[USER_ID]',
|
||||
secret: '[SECRET]',
|
||||
password: 'password',
|
||||
passwordAgain: 'password',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateSession(
|
||||
sessionId:'[SESSION_ID]' ,
|
||||
sessionId: '[SESSION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.updateVerification(
|
||||
userId:'[USER_ID]' ,
|
||||
secret:'[SECRET]' ,
|
||||
userId: '[USER_ID]',
|
||||
secret: '[SECRET]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Account account = Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = account.verifyAuthenticator(
|
||||
factor: AuthenticatorFactor.totp.value,
|
||||
otp:'[OTP]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -10,7 +10,7 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = avatars.getBrowser(
|
||||
code: Browser.avantBrowser.value,
|
||||
code: 'aa',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -22,7 +22,7 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: avatars.getBrowser(
|
||||
code: Browser.avantBrowser.value,
|
||||
code: 'aa',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = avatars.getCreditCard(
|
||||
code: CreditCard.americanExpress.value,
|
||||
code: 'amex',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -22,7 +22,7 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: avatars.getCreditCard(
|
||||
code: CreditCard.americanExpress.value,
|
||||
code: 'amex',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = avatars.getFavicon(
|
||||
url:'https://example.com' ,
|
||||
url: 'https://example.com',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -22,7 +22,7 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: avatars.getFavicon(
|
||||
url:'https://example.com' ,
|
||||
url: 'https://example.com',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = avatars.getFlag(
|
||||
code: Flag.afghanistan.value,
|
||||
code: 'af',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -22,7 +22,7 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: avatars.getFlag(
|
||||
code: Flag.afghanistan.value,
|
||||
code: 'af',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = avatars.getImage(
|
||||
url:'https://example.com' ,
|
||||
url: 'https://example.com',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -22,7 +22,7 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: avatars.getImage(
|
||||
url:'https://example.com' ,
|
||||
url: 'https://example.com',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -10,7 +10,7 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = avatars.getQR(
|
||||
text:'[TEXT]' ,
|
||||
text: '[TEXT]',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -22,7 +22,7 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: avatars.getQR(
|
||||
text:'[TEXT]' ,
|
||||
text: '[TEXT]',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -9,10 +9,10 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = databases.createDocument(
|
||||
databaseId:'[DATABASE_ID]' ,
|
||||
collectionId:'[COLLECTION_ID]' ,
|
||||
documentId:'[DOCUMENT_ID]' ,
|
||||
data:{} ,
|
||||
databaseId: '[DATABASE_ID]',
|
||||
collectionId: '[COLLECTION_ID]',
|
||||
documentId: '[DOCUMENT_ID]',
|
||||
data: {},
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,9 +9,9 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = databases.deleteDocument(
|
||||
databaseId:'[DATABASE_ID]' ,
|
||||
collectionId:'[COLLECTION_ID]' ,
|
||||
documentId:'[DOCUMENT_ID]' ,
|
||||
databaseId: '[DATABASE_ID]',
|
||||
collectionId: '[COLLECTION_ID]',
|
||||
documentId: '[DOCUMENT_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,9 +9,9 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = databases.getDocument(
|
||||
databaseId:'[DATABASE_ID]' ,
|
||||
collectionId:'[COLLECTION_ID]' ,
|
||||
documentId:'[DOCUMENT_ID]' ,
|
||||
databaseId: '[DATABASE_ID]',
|
||||
collectionId: '[COLLECTION_ID]',
|
||||
documentId: '[DOCUMENT_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = databases.listDocuments(
|
||||
databaseId:'[DATABASE_ID]' ,
|
||||
collectionId:'[COLLECTION_ID]' ,
|
||||
databaseId: '[DATABASE_ID]',
|
||||
collectionId: '[COLLECTION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,9 +9,9 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = databases.updateDocument(
|
||||
databaseId:'[DATABASE_ID]' ,
|
||||
collectionId:'[COLLECTION_ID]' ,
|
||||
documentId:'[DOCUMENT_ID]' ,
|
||||
databaseId: '[DATABASE_ID]',
|
||||
collectionId: '[COLLECTION_ID]',
|
||||
documentId: '[DOCUMENT_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = functions.createExecution(
|
||||
functionId:'[FUNCTION_ID]' ,
|
||||
functionId: '[FUNCTION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = functions.getExecution(
|
||||
functionId:'[FUNCTION_ID]' ,
|
||||
executionId:'[EXECUTION_ID]' ,
|
||||
functionId: '[FUNCTION_ID]',
|
||||
executionId: '[EXECUTION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = functions.listExecutions(
|
||||
functionId:'[FUNCTION_ID]' ,
|
||||
functionId: '[FUNCTION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = graphql.mutation(
|
||||
query:{} ,
|
||||
query: {},
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = graphql.query(
|
||||
query:{} ,
|
||||
query: {},
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Messaging messaging = Messaging(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = messaging.createSubscriber(
|
||||
topicId:'[TOPIC_ID]' ,
|
||||
subscriberId:'[SUBSCRIBER_ID]' ,
|
||||
targetId:'[TARGET_ID]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Messaging messaging = Messaging(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = messaging.deleteSubscriber(
|
||||
topicId:'[TOPIC_ID]' ,
|
||||
subscriberId:'[SUBSCRIBER_ID]' ,
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -10,9 +10,9 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = storage.createFile(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
file:InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg') ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'),
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = storage.deleteFile(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -10,8 +10,8 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = storage.getFileDownload(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -23,8 +23,8 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: storage.getFileDownload(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -10,8 +10,8 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = storage.getFilePreview(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -23,8 +23,8 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: storage.getFilePreview(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -10,8 +10,8 @@ void main() { // Init SDK
|
||||
;
|
||||
// downloading file
|
||||
Future result = storage.getFileView(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
).then((bytes) {
|
||||
final file = File('path_to_file/filename.ext');
|
||||
file.writeAsBytesSync(bytes)
|
||||
@@ -23,8 +23,8 @@ void main() { // Init SDK
|
||||
//displaying image preview
|
||||
FutureBuilder(
|
||||
future: storage.getFileView(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
), //works for both public file and private file, for private files you need to be logged in
|
||||
builder: (context, snapshot) {
|
||||
return snapshot.hasData && snapshot.data != null
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = storage.getFile(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = storage.listFiles(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = storage.updateFile(
|
||||
bucketId:'[BUCKET_ID]' ,
|
||||
fileId:'[FILE_ID]' ,
|
||||
bucketId: '[BUCKET_ID]',
|
||||
fileId: '[FILE_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.createMembership(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
roles:[] ,
|
||||
teamId: '[TEAM_ID]',
|
||||
roles: [],
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.create(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
name:'[NAME]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
name: '[NAME]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.deleteMembership(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
membershipId:'[MEMBERSHIP_ID]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
membershipId: '[MEMBERSHIP_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.delete(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.getMembership(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
membershipId:'[MEMBERSHIP_ID]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
membershipId: '[MEMBERSHIP_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.getPrefs(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.get(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.listMemberships(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,10 +9,10 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.updateMembershipStatus(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
membershipId:'[MEMBERSHIP_ID]' ,
|
||||
userId:'[USER_ID]' ,
|
||||
secret:'[SECRET]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
membershipId: '[MEMBERSHIP_ID]',
|
||||
userId: '[USER_ID]',
|
||||
secret: '[SECRET]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,9 +9,9 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.updateMembership(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
membershipId:'[MEMBERSHIP_ID]' ,
|
||||
roles:[] ,
|
||||
teamId: '[TEAM_ID]',
|
||||
membershipId: '[MEMBERSHIP_ID]',
|
||||
roles: [],
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.updateName(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
name:'[NAME]' ,
|
||||
teamId: '[TEAM_ID]',
|
||||
name: '[NAME]',
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -9,8 +9,8 @@ void main() { // Init SDK
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = teams.updatePrefs(
|
||||
teamId:'[TEAM_ID]' ,
|
||||
prefs:{} ,
|
||||
teamId: '[TEAM_ID]',
|
||||
prefs: {},
|
||||
);
|
||||
|
||||
result
|
||||
|
||||
@@ -7,13 +7,10 @@ library appwrite;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'src/enums.dart';
|
||||
import 'src/service.dart';
|
||||
import 'src/input_file.dart';
|
||||
import 'models.dart' as models;
|
||||
import 'enums.dart' as enums;
|
||||
import 'src/upload_progress.dart';
|
||||
|
||||
export 'src/response.dart';
|
||||
@@ -35,6 +32,5 @@ part 'services/databases.dart';
|
||||
part 'services/functions.dart';
|
||||
part 'services/graphql.dart';
|
||||
part 'services/locale.dart';
|
||||
part 'services/messaging.dart';
|
||||
part 'services/storage.dart';
|
||||
part 'services/teams.dart';
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/// Appwrite Enums
|
||||
library appwrite.enums;
|
||||
|
||||
part 'src/enums/authenticator_provider.dart';
|
||||
part 'src/enums/authenticator_factor.dart';
|
||||
part 'src/enums/o_auth_provider.dart';
|
||||
part 'src/enums/browser.dart';
|
||||
part 'src/enums/credit_card.dart';
|
||||
part 'src/enums/flag.dart';
|
||||
part 'src/enums/execution_method.dart';
|
||||
part 'src/enums/image_gravity.dart';
|
||||
part 'src/enums/image_format.dart';
|
||||
@@ -43,8 +43,3 @@ part 'src/models/language.dart';
|
||||
part 'src/models/currency.dart';
|
||||
part 'src/models/phone.dart';
|
||||
part 'src/models/headers.dart';
|
||||
part 'src/models/mfa_challenge.dart';
|
||||
part 'src/models/mfa_provider.dart';
|
||||
part 'src/models/mfa_providers.dart';
|
||||
part 'src/models/subscriber.dart';
|
||||
part 'src/models/target.dart';
|
||||
|
||||
+31
-55
@@ -1,32 +1,8 @@
|
||||
part of appwrite;
|
||||
|
||||
|
||||
/// Helper class to generate query strings.
|
||||
class Query {
|
||||
final String method;
|
||||
final String? attribute;
|
||||
final dynamic values;
|
||||
|
||||
Query._(this.method, [this.attribute = null, this.values = null]);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{
|
||||
'method': method,
|
||||
};
|
||||
|
||||
if(attribute != null) {
|
||||
map['attribute'] = attribute;
|
||||
}
|
||||
|
||||
if(values != null) {
|
||||
map['values'] = values is List ? values : [values];
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => jsonEncode(toJson());
|
||||
Query._();
|
||||
|
||||
/// Filter resources where [attribute] is equal to [value].
|
||||
///
|
||||
@@ -34,90 +10,90 @@ class Query {
|
||||
/// the query will return resources where [attribute] is equal
|
||||
/// to any of the values in the list.
|
||||
static String equal(String attribute, dynamic value) =>
|
||||
Query._('equal', attribute, value).toString();
|
||||
_addQuery(attribute, 'equal', value);
|
||||
|
||||
/// Filter resources where [attribute] is not equal to [value].
|
||||
///
|
||||
/// [value] can be a single value or a list. If a list is used
|
||||
/// the query will return resources where [attribute] is equal
|
||||
/// to any of the values in the list.
|
||||
static String notEqual(String attribute, dynamic value) =>
|
||||
Query._('notEqual', attribute, [value]).toString();
|
||||
_addQuery(attribute, 'notEqual', value);
|
||||
|
||||
/// Filter resources where [attribute] is less than [value].
|
||||
static String lessThan(String attribute, dynamic value) =>
|
||||
Query._('lessThan', attribute, value).toString();
|
||||
_addQuery(attribute, 'lessThan', value);
|
||||
|
||||
/// Filter resources where [attribute] is less than or equal to [value].
|
||||
static String lessThanEqual(String attribute, dynamic value) =>
|
||||
Query._('lessThanEqual', attribute, value).toString();
|
||||
_addQuery(attribute, 'lessThanEqual', value);
|
||||
|
||||
/// Filter resources where [attribute] is greater than [value].
|
||||
static String greaterThan(String attribute, dynamic value) =>
|
||||
Query._('greaterThan', attribute, value).toString();
|
||||
_addQuery(attribute, 'greaterThan', value);
|
||||
|
||||
/// Filter resources where [attribute] is greater than or equal to [value].
|
||||
static String greaterThanEqual(String attribute, dynamic value) =>
|
||||
Query._('greaterThanEqual', attribute, value).toString();
|
||||
_addQuery(attribute, 'greaterThanEqual', value);
|
||||
|
||||
/// Filter resources where by searching [attribute] for [value].
|
||||
static String search(String attribute, String value) =>
|
||||
Query._('search', attribute, value).toString();
|
||||
_addQuery(attribute, 'search', value);
|
||||
|
||||
/// Filter resources where [attribute] is null.
|
||||
static String isNull(String attribute) => Query._('isNull', attribute).toString();
|
||||
static String isNull(String attribute) => 'isNull("$attribute")';
|
||||
|
||||
/// Filter resources where [attribute] is not null.
|
||||
static String isNotNull(String attribute) => Query._('isNotNull', attribute).toString();
|
||||
static String isNotNull(String attribute) => 'isNotNull("$attribute")';
|
||||
|
||||
/// Filter resources where [attribute] is between [start] and [end] (inclusive).
|
||||
static String between(String attribute, dynamic start, dynamic end) =>
|
||||
Query._('between', attribute, [start, end]).toString();
|
||||
'between("$attribute", ${_parseValues(start)}, ${_parseValues(end)})';
|
||||
|
||||
/// Filter resources where [attribute] starts with [value].
|
||||
static String startsWith(String attribute, String value) =>
|
||||
Query._('startsWith', attribute, value).toString();
|
||||
_addQuery(attribute, 'startsWith', value);
|
||||
|
||||
/// Filter resources where [attribute] ends with [value].
|
||||
static String endsWith(String attribute, String value) =>
|
||||
Query._('endsWith', attribute, value).toString();
|
||||
|
||||
/// Filter resources where [attribute] contains [value]
|
||||
/// [value] can be a single value or a list.
|
||||
static String contains(String attribute, dynamic value) =>
|
||||
Query._('contains', attribute, value).toString();
|
||||
|
||||
static String or(List<String> queries) =>
|
||||
Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString();
|
||||
|
||||
static String and(List<String> queries) =>
|
||||
Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString();
|
||||
_addQuery(attribute, 'endsWith', value);
|
||||
|
||||
/// Specify which attributes should be returned by the API call.
|
||||
static String select(List<String> attributes) =>
|
||||
Query._('select', null, attributes).toString();
|
||||
'select([${attributes.map((attr) => "\"$attr\"").join(",")}])';
|
||||
|
||||
/// Sort results by [attribute] ascending.
|
||||
static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString();
|
||||
static String orderAsc(String attribute) => 'orderAsc("$attribute")';
|
||||
|
||||
/// Sort results by [attribute] descending.
|
||||
static String orderDesc(String attribute) => Query._('orderDesc', attribute).toString();
|
||||
static String orderDesc(String attribute) => 'orderDesc("$attribute")';
|
||||
|
||||
/// Return results before [id].
|
||||
///
|
||||
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
|
||||
/// docs for more information.
|
||||
static String cursorBefore(String id) => Query._('cursorBefore', null, id).toString();
|
||||
static String cursorBefore(String id) => 'cursorBefore("$id")';
|
||||
|
||||
/// Return results after [id].
|
||||
///
|
||||
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
|
||||
/// docs for more information.
|
||||
static String cursorAfter(String id) => Query._('cursorAfter', null, id).toString();
|
||||
static String cursorAfter(String id) => 'cursorAfter("$id")';
|
||||
|
||||
/// Return only [limit] results.
|
||||
static String limit(int limit) => Query._('limit', null, limit).toString();
|
||||
static String limit(int limit) => 'limit($limit)';
|
||||
|
||||
/// Return results from [offset].
|
||||
///
|
||||
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
|
||||
/// docs for more information.
|
||||
static String offset(int offset) => Query._('offset', null, offset).toString();
|
||||
static String offset(int offset) => 'offset($offset)';
|
||||
|
||||
static String _addQuery(String attribute, String method, dynamic value) => (value
|
||||
is List)
|
||||
? '$method("$attribute", [${value.map((item) => _parseValues(item)).join(",")}])'
|
||||
: '$method("$attribute", [${_parseValues(value)}])';
|
||||
|
||||
static String _parseValues(dynamic value) =>
|
||||
(value is String) ? '"$value"' : '$value';
|
||||
}
|
||||
+99
-311
@@ -84,7 +84,7 @@ class Account extends Service {
|
||||
/// List Identities
|
||||
///
|
||||
/// Get the list of identities for the currently logged in user.
|
||||
Future<models.IdentityList> listIdentities({List<String>? queries}) async {
|
||||
Future<models.IdentityList> listIdentities({String? queries}) async {
|
||||
const String apiPath = '/account/identities';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
@@ -101,7 +101,7 @@ class Account extends Service {
|
||||
|
||||
}
|
||||
|
||||
/// Delete identity
|
||||
/// Delete Identity
|
||||
///
|
||||
/// Delete an identity by its unique ID.
|
||||
Future deleteIdentity({required String identityId}) async {
|
||||
@@ -164,139 +164,6 @@ class Account extends Service {
|
||||
|
||||
}
|
||||
|
||||
/// Update MFA
|
||||
///
|
||||
Future<models.User> updateMFA({required bool mfa}) async {
|
||||
const String apiPath = '/account/mfa';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'mfa': mfa,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.User.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Create MFA Challenge
|
||||
///
|
||||
Future<models.MfaChallenge> createChallenge({required enums.AuthenticatorProvider provider}) async {
|
||||
const String apiPath = '/account/mfa/challenge';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'provider': provider,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.MfaChallenge.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Create MFA Challenge (confirmation)
|
||||
///
|
||||
Future updateChallenge({required String challengeId, required String otp}) async {
|
||||
const String apiPath = '/account/mfa/challenge';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'challengeId': challengeId,
|
||||
'otp': otp,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// List Factors
|
||||
///
|
||||
/// Get the currently logged in user.
|
||||
Future<models.MfaProviders> listFactors() async {
|
||||
const String apiPath = '/account/mfa/factors';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.MfaProviders.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Add Authenticator
|
||||
///
|
||||
Future<models.MfaProvider> addAuthenticator({required enums.AuthenticatorFactor factor}) async {
|
||||
final String apiPath = '/account/mfa/{factor}'.replaceAll('{factor}', factor);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.MfaProvider.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Verify Authenticator
|
||||
///
|
||||
Future<models.User> verifyAuthenticator({required enums.AuthenticatorFactor factor, required String otp}) async {
|
||||
final String apiPath = '/account/mfa/{factor}'.replaceAll('{factor}', factor);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'otp': otp,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.User.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Delete Authenticator
|
||||
///
|
||||
Future<models.User> deleteAuthenticator({required enums.AuthenticatorProvider provider, required String otp}) async {
|
||||
final String apiPath = '/account/mfa/{provider}'.replaceAll('{provider}', provider);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'otp': otp,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.User.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Update name
|
||||
///
|
||||
/// Update currently logged in user account name.
|
||||
@@ -446,13 +313,14 @@ class Account extends Service {
|
||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URLs are the ones from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
Future<models.Token> updateRecovery({required String userId, required String secret, required String password}) async {
|
||||
Future<models.Token> updateRecovery({required String userId, required String secret, required String password, required String passwordAgain}) async {
|
||||
const String apiPath = '/account/recovery';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'userId': userId,
|
||||
'secret': secret,
|
||||
'password': password,
|
||||
'passwordAgain': passwordAgain,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
@@ -530,7 +398,7 @@ class Account extends Service {
|
||||
|
||||
}
|
||||
|
||||
/// Create email password session
|
||||
/// Create email session
|
||||
///
|
||||
/// Allow the user to login into their account by providing a valid email and
|
||||
/// password combination. This route will create a new session for the user.
|
||||
@@ -538,7 +406,7 @@ class Account extends Service {
|
||||
/// A user is limited to 10 active sessions at a time by default. [Learn more
|
||||
/// about session
|
||||
/// limits](https://appwrite.io/docs/authentication-security#limits).
|
||||
Future<models.Session> createEmailPasswordSession({required String email, required String password}) async {
|
||||
Future<models.Session> createEmailSession({required String email, required String password}) async {
|
||||
const String apiPath = '/account/sessions/email';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
@@ -556,11 +424,56 @@ class Account extends Service {
|
||||
|
||||
}
|
||||
|
||||
/// Create session (deprecated)
|
||||
/// Create magic URL session
|
||||
///
|
||||
/// Use this endpoint to create a session from token. Provide the **userId**
|
||||
/// and **secret** parameters from the successful response of authentication
|
||||
/// flows initiated by token creation. For example, magic URL and phone login.
|
||||
/// Sends the user an email with a secret key for creating a session. If the
|
||||
/// provided user ID has not been registered, a new user will be created. When
|
||||
/// the user clicks the link in the email, the user is redirected back to the
|
||||
/// URL you provided with the secret key and userId values attached to the URL
|
||||
/// query string. Use the query string parameters to submit a request to the
|
||||
/// [PUT
|
||||
/// /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#updateMagicURLSession)
|
||||
/// endpoint to complete the login process. The link sent to the user's email
|
||||
/// address is valid for 1 hour. If you are on a mobile device you can leave
|
||||
/// the URL parameter empty, so that the login completion will be handled by
|
||||
/// your Appwrite instance by default.
|
||||
///
|
||||
/// A user is limited to 10 active sessions at a time by default. [Learn more
|
||||
/// about session
|
||||
/// limits](https://appwrite.io/docs/authentication-security#limits).
|
||||
///
|
||||
Future<models.Token> createMagicURLSession({required String userId, required String email, String? url}) async {
|
||||
const String apiPath = '/account/sessions/magic-url';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'userId': userId,
|
||||
'email': email,
|
||||
'url': url,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Token.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Create magic URL session (confirmation)
|
||||
///
|
||||
/// Use this endpoint to complete creating the session with the Magic URL. Both
|
||||
/// the **userId** and **secret** arguments will be passed as query parameters
|
||||
/// to the redirect URL you have provided when sending your request to the
|
||||
/// [POST
|
||||
/// /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#createMagicURLSession)
|
||||
/// endpoint.
|
||||
///
|
||||
/// Please note that in order to avoid a [Redirect
|
||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URLs are the ones from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
Future<models.Session> updateMagicURLSession({required String userId, required String secret}) async {
|
||||
const String apiPath = '/account/sessions/magic-url';
|
||||
|
||||
@@ -597,14 +510,13 @@ class Account extends Service {
|
||||
/// about session
|
||||
/// limits](https://appwrite.io/docs/authentication-security#limits).
|
||||
///
|
||||
Future createOAuth2Session({required enums.OAuthProvider provider, String? success, String? failure, bool? token, List<String>? scopes}) async {
|
||||
Future createOAuth2Session({required String provider, String? success, String? failure, List<String>? scopes}) async {
|
||||
final String apiPath = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'token': token,
|
||||
'scopes': scopes,
|
||||
|
||||
'project': client.config['project'],
|
||||
@@ -633,13 +545,45 @@ class Account extends Service {
|
||||
return client.webAuth(url, callbackUrlScheme: success);
|
||||
}
|
||||
|
||||
/// Create session
|
||||
/// Create phone session
|
||||
///
|
||||
/// Use this endpoint to create a session from token. Provide the **userId**
|
||||
/// and **secret** parameters from the successful response of authentication
|
||||
/// flows initiated by token creation. For example, magic URL and phone login.
|
||||
Future<models.Session> createSession({required String userId, required String secret}) async {
|
||||
const String apiPath = '/account/sessions/token';
|
||||
/// Sends the user an SMS with a secret key for creating a session. If the
|
||||
/// provided user ID has not be registered, a new user will be created. Use the
|
||||
/// returned user ID and secret and submit a request to the [PUT
|
||||
/// /account/sessions/phone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneSession)
|
||||
/// endpoint to complete the login process. The secret sent to the user's phone
|
||||
/// is valid for 15 minutes.
|
||||
///
|
||||
/// A user is limited to 10 active sessions at a time by default. [Learn more
|
||||
/// about session
|
||||
/// limits](https://appwrite.io/docs/authentication-security#limits).
|
||||
Future<models.Token> createPhoneSession({required String userId, required String phone}) async {
|
||||
const String apiPath = '/account/sessions/phone';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'userId': userId,
|
||||
'phone': phone,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Token.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Create phone session (confirmation)
|
||||
///
|
||||
/// Use this endpoint to complete creating a session with SMS. Use the
|
||||
/// **userId** from the
|
||||
/// [createPhoneSession](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneSession)
|
||||
/// endpoint and the **secret** received via SMS to successfully update and
|
||||
/// confirm the phone session.
|
||||
Future<models.Session> updatePhoneSession({required String userId, required String secret}) async {
|
||||
const String apiPath = '/account/sessions/phone';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'userId': userId,
|
||||
@@ -650,7 +594,7 @@ class Account extends Service {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Session.fromMap(res.data);
|
||||
|
||||
@@ -676,10 +620,11 @@ class Account extends Service {
|
||||
|
||||
}
|
||||
|
||||
/// Update (or renew) a session
|
||||
/// Update OAuth session (refresh tokens)
|
||||
///
|
||||
/// Extend session's expiry to increase it's lifespan. Extending a session is
|
||||
/// useful when session length is short such as 5 minutes.
|
||||
/// Access tokens have limited lifespan and expire to mitigate security risks.
|
||||
/// If session was created using an OAuth provider, this route can be used to
|
||||
/// "refresh" the access token.
|
||||
Future<models.Session> updateSession({required String sessionId}) async {
|
||||
final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId);
|
||||
|
||||
@@ -740,163 +685,6 @@ class Account extends Service {
|
||||
|
||||
}
|
||||
|
||||
/// Create a push target
|
||||
///
|
||||
Future<models.Target> createPushTarget({required String targetId, required String identifier, String? providerId}) async {
|
||||
const String apiPath = '/account/targets/push';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'targetId': targetId,
|
||||
'identifier': identifier,
|
||||
'providerId': providerId,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Target.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Update a push target
|
||||
///
|
||||
Future<models.Target> updatePushTarget({required String targetId, required String identifier}) async {
|
||||
final String apiPath = '/account/targets/{targetId}/push'.replaceAll('{targetId}', targetId);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'identifier': identifier,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Target.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Delete a push target
|
||||
///
|
||||
Future deletePushTarget({required String targetId}) async {
|
||||
final String apiPath = '/account/targets/{targetId}/push'.replaceAll('{targetId}', targetId);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// Create email token (OTP)
|
||||
///
|
||||
/// Sends the user an email with a secret key for creating a session. If the
|
||||
/// provided user ID has not be registered, a new user will be created. Use the
|
||||
/// returned user ID and secret and submit a request to the [POST
|
||||
/// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
||||
/// endpoint to complete the login process. The secret sent to the user's email
|
||||
/// is valid for 15 minutes.
|
||||
///
|
||||
/// A user is limited to 10 active sessions at a time by default. [Learn more
|
||||
/// about session
|
||||
/// limits](https://appwrite.io/docs/authentication-security#limits).
|
||||
Future<models.Token> createEmailToken({required String userId, required String email, bool? phrase}) async {
|
||||
const String apiPath = '/account/tokens/email';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'userId': userId,
|
||||
'email': email,
|
||||
'phrase': phrase,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Token.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Create magic URL token
|
||||
///
|
||||
/// Sends the user an email with a secret key for creating a session. If the
|
||||
/// provided user ID has not been registered, a new user will be created. When
|
||||
/// the user clicks the link in the email, the user is redirected back to the
|
||||
/// URL you provided with the secret key and userId values attached to the URL
|
||||
/// query string. Use the query string parameters to submit a request to the
|
||||
/// [POST
|
||||
/// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
||||
/// endpoint to complete the login process. The link sent to the user's email
|
||||
/// address is valid for 1 hour. If you are on a mobile device you can leave
|
||||
/// the URL parameter empty, so that the login completion will be handled by
|
||||
/// your Appwrite instance by default.
|
||||
///
|
||||
/// A user is limited to 10 active sessions at a time by default. [Learn more
|
||||
/// about session
|
||||
/// limits](https://appwrite.io/docs/authentication-security#limits).
|
||||
///
|
||||
Future<models.Token> createMagicURLToken({required String userId, required String email, String? url, bool? phrase}) async {
|
||||
const String apiPath = '/account/tokens/magic-url';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'userId': userId,
|
||||
'email': email,
|
||||
'url': url,
|
||||
'phrase': phrase,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Token.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Create phone token
|
||||
///
|
||||
/// Sends the user an SMS with a secret key for creating a session. If the
|
||||
/// provided user ID has not be registered, a new user will be created. Use the
|
||||
/// returned user ID and secret and submit a request to the [POST
|
||||
/// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
||||
/// endpoint to complete the login process. The secret sent to the user's phone
|
||||
/// is valid for 15 minutes.
|
||||
///
|
||||
/// A user is limited to 10 active sessions at a time by default. [Learn more
|
||||
/// about session
|
||||
/// limits](https://appwrite.io/docs/authentication-security#limits).
|
||||
Future<models.Token> createPhoneToken({required String userId, required String phone}) async {
|
||||
const String apiPath = '/account/tokens/phone';
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'userId': userId,
|
||||
'phone': phone,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Token.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Create email verification
|
||||
///
|
||||
/// Use this endpoint to send a verification message to your user email address
|
||||
|
||||
@@ -18,7 +18,7 @@ class Avatars extends Service {
|
||||
/// with preserved aspect ratio. If both dimensions are 0, the API provides an
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
Future<Uint8List> getBrowser({required enums.Browser code, int? width, int? height, int? quality}) async {
|
||||
Future<Uint8List> getBrowser({required String code, int? width, int? height, int? quality}) async {
|
||||
final String apiPath = '/avatars/browsers/{code}'.replaceAll('{code}', code);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
@@ -45,7 +45,7 @@ class Avatars extends Service {
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
Future<Uint8List> getCreditCard({required enums.CreditCard code, int? width, int? height, int? quality}) async {
|
||||
Future<Uint8List> getCreditCard({required String code, int? width, int? height, int? quality}) async {
|
||||
final String apiPath = '/avatars/credit-cards/{code}'.replaceAll('{code}', code);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
@@ -92,7 +92,7 @@ class Avatars extends Service {
|
||||
/// image at source quality. If dimensions are not specified, the default size
|
||||
/// of image returned is 100x100px.
|
||||
///
|
||||
Future<Uint8List> getFlag({required enums.Flag code, int? width, int? height, int? quality}) async {
|
||||
Future<Uint8List> getFlag({required String code, int? width, int? height, int? quality}) async {
|
||||
final String apiPath = '/avatars/flags/{code}'.replaceAll('{code}', code);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
@@ -34,7 +34,7 @@ class Functions extends Service {
|
||||
/// current execution status. You can ping the `Get Execution` endpoint to get
|
||||
/// updates on the current execution status. Once this endpoint is called, your
|
||||
/// function execution process will start asynchronously.
|
||||
Future<models.Execution> createExecution({required String functionId, String? body, bool? xasync, String? path, enums.ExecutionMethod? method, Map? headers}) async {
|
||||
Future<models.Execution> createExecution({required String functionId, String? body, bool? xasync, String? path, String? method, Map? headers}) async {
|
||||
final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
part of appwrite;
|
||||
|
||||
/// The Messaging service allows you to send messages to any provider type
|
||||
/// (SMTP, push notification, SMS, etc.).
|
||||
class Messaging extends Service {
|
||||
/// Initializes a [Messaging] service
|
||||
Messaging(super.client);
|
||||
|
||||
/// Create a subscriber.
|
||||
///
|
||||
Future<models.Subscriber> createSubscriber({required String topicId, required String subscriberId, required String targetId}) async {
|
||||
final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
'subscriberId': subscriberId,
|
||||
'targetId': targetId,
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return models.Subscriber.fromMap(res.data);
|
||||
|
||||
}
|
||||
|
||||
/// Delete a subscriber.
|
||||
///
|
||||
Future deleteSubscriber({required String topicId, required String subscriberId}) async {
|
||||
final String apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replaceAll('{topicId}', topicId).replaceAll('{subscriberId}', subscriberId);
|
||||
|
||||
final Map<String, dynamic> apiParams = {
|
||||
};
|
||||
|
||||
final Map<String, String> apiHeaders = {
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders);
|
||||
|
||||
return res.data;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ class Storage extends Service {
|
||||
/// 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.
|
||||
Future<Uint8List> getFilePreview({required String bucketId, required String fileId, int? width, int? height, enums.ImageGravity? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, enums.ImageFormat? output}) async {
|
||||
Future<Uint8List> getFilePreview({required String bucketId, required String fileId, int? width, int? height, String? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, String? output}) async {
|
||||
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
|
||||
@@ -66,11 +66,6 @@ abstract class Client {
|
||||
/// Set Locale.
|
||||
Client setLocale(value);
|
||||
|
||||
/// Set Session.
|
||||
///
|
||||
/// The user session to authenticate with.
|
||||
Client setSession(value);
|
||||
|
||||
/// Add headers that should be sent with all API calls.
|
||||
Client addHeader(String key, String value);
|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@ abstract class ClientBase implements Client {
|
||||
ClientBase setJWT(value);
|
||||
@override
|
||||
ClientBase setLocale(value);
|
||||
/// The user session to authenticate with
|
||||
@override
|
||||
ClientBase setSession(value);
|
||||
|
||||
@override
|
||||
ClientBase setSelfSigned({bool status = true});
|
||||
|
||||
@@ -43,7 +43,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
|
||||
'x-sdk-name': 'Flutter',
|
||||
'x-sdk-platform': 'client',
|
||||
'x-sdk-language': 'flutter',
|
||||
'x-sdk-version': '12.0.0-rc.1',
|
||||
'x-sdk-version': '11.0.1',
|
||||
'X-Appwrite-Response-Format': '1.4.0',
|
||||
};
|
||||
|
||||
@@ -77,13 +77,6 @@ class ClientBrowser extends ClientBase with ClientMixin {
|
||||
addHeader('X-Appwrite-Locale', value);
|
||||
return this;
|
||||
}
|
||||
/// The user session to authenticate with
|
||||
@override
|
||||
ClientBrowser setSession(value) {
|
||||
config['session'] = value;
|
||||
addHeader('X-Appwrite-Session', value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
ClientBrowser setSelfSigned({bool status = true}) {
|
||||
|
||||
@@ -64,7 +64,7 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
'x-sdk-name': 'Flutter',
|
||||
'x-sdk-platform': 'client',
|
||||
'x-sdk-language': 'flutter',
|
||||
'x-sdk-version': '12.0.0-rc.1',
|
||||
'x-sdk-version': '11.0.1',
|
||||
'X-Appwrite-Response-Format' : '1.4.0',
|
||||
};
|
||||
|
||||
@@ -106,13 +106,6 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
addHeader('X-Appwrite-Locale', value);
|
||||
return this;
|
||||
}
|
||||
/// The user session to authenticate with
|
||||
@override
|
||||
ClientIO setSession(value) {
|
||||
config['session'] = value;
|
||||
addHeader('X-Appwrite-Session', value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
ClientIO setSelfSigned({bool status = true}) {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum AuthenticatorFactor {
|
||||
totp(value: 'totp');
|
||||
|
||||
const AuthenticatorFactor({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum AuthenticatorProvider {
|
||||
totp(value: 'totp');
|
||||
|
||||
const AuthenticatorProvider({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum Browser {
|
||||
avantBrowser(value: 'aa'),
|
||||
androidWebViewBeta(value: 'an'),
|
||||
googleChrome(value: 'ch'),
|
||||
googleChromeIOS(value: 'ci'),
|
||||
googleChromeMobile(value: 'cm'),
|
||||
chromium(value: 'cr'),
|
||||
mozillaFirefox(value: 'ff'),
|
||||
safari(value: 'sf'),
|
||||
mobileSafari(value: 'mf'),
|
||||
microsoftEdge(value: 'ps'),
|
||||
microsoftEdgeIOS(value: 'oi'),
|
||||
operaMini(value: 'om'),
|
||||
opera(value: 'op'),
|
||||
operaNext(value: 'on');
|
||||
|
||||
const Browser({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum CreditCard {
|
||||
americanExpress(value: 'amex'),
|
||||
argencard(value: 'argencard'),
|
||||
cabal(value: 'cabal'),
|
||||
consosud(value: 'censosud'),
|
||||
dinersClub(value: 'diners'),
|
||||
discover(value: 'discover'),
|
||||
elo(value: 'elo'),
|
||||
hipercard(value: 'hipercard'),
|
||||
jCB(value: 'jcb'),
|
||||
mastercard(value: 'mastercard'),
|
||||
naranja(value: 'naranja'),
|
||||
tarjetaShopping(value: 'targeta-shopping'),
|
||||
unionChinaPay(value: 'union-china-pay'),
|
||||
visa(value: 'visa'),
|
||||
mIR(value: 'mir'),
|
||||
maestro(value: 'maestro');
|
||||
|
||||
const CreditCard({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum ExecutionMethod {
|
||||
gET(value: 'GET'),
|
||||
pOST(value: 'POST'),
|
||||
pUT(value: 'PUT'),
|
||||
pATCH(value: 'PATCH'),
|
||||
dELETE(value: 'DELETE'),
|
||||
oPTIONS(value: 'OPTIONS');
|
||||
|
||||
const ExecutionMethod({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum Flag {
|
||||
afghanistan(value: 'af'),
|
||||
angola(value: 'ao'),
|
||||
albania(value: 'al'),
|
||||
andorra(value: 'ad'),
|
||||
unitedArabEmirates(value: 'ae'),
|
||||
argentina(value: 'ar'),
|
||||
armenia(value: 'am'),
|
||||
antiguaAndBarbuda(value: 'ag'),
|
||||
australia(value: 'au'),
|
||||
austria(value: 'at'),
|
||||
azerbaijan(value: 'az'),
|
||||
burundi(value: 'bi'),
|
||||
belgium(value: 'be'),
|
||||
benin(value: 'bj'),
|
||||
burkinaFaso(value: 'bf'),
|
||||
bangladesh(value: 'bd'),
|
||||
bulgaria(value: 'bg'),
|
||||
bahrain(value: 'bh'),
|
||||
bahamas(value: 'bs'),
|
||||
bosniaAndHerzegovina(value: 'ba'),
|
||||
belarus(value: 'by'),
|
||||
belize(value: 'bz'),
|
||||
bolivia(value: 'bo'),
|
||||
brazil(value: 'br'),
|
||||
barbados(value: 'bb'),
|
||||
bruneiDarussalam(value: 'bn'),
|
||||
bhutan(value: 'bt'),
|
||||
botswana(value: 'bw'),
|
||||
centralAfricanRepublic(value: 'cf'),
|
||||
canada(value: 'ca'),
|
||||
switzerland(value: 'ch'),
|
||||
chile(value: 'cl'),
|
||||
china(value: 'cn'),
|
||||
cTeDIvoire(value: 'ci'),
|
||||
cameroon(value: 'cm'),
|
||||
democraticRepublicOfTheCongo(value: 'cd'),
|
||||
republicOfTheCongo(value: 'cg'),
|
||||
colombia(value: 'co'),
|
||||
comoros(value: 'km'),
|
||||
capeVerde(value: 'cv'),
|
||||
costaRica(value: 'cr'),
|
||||
cuba(value: 'cu'),
|
||||
cyprus(value: 'cy'),
|
||||
czechRepublic(value: 'cz'),
|
||||
germany(value: 'de'),
|
||||
djibouti(value: 'dj'),
|
||||
dominica(value: 'dm'),
|
||||
denmark(value: 'dk'),
|
||||
dominicanRepublic(value: 'do'),
|
||||
algeria(value: 'dz'),
|
||||
ecuador(value: 'ec'),
|
||||
egypt(value: 'eg'),
|
||||
eritrea(value: 'er'),
|
||||
spain(value: 'es'),
|
||||
estonia(value: 'ee'),
|
||||
ethiopia(value: 'et'),
|
||||
finland(value: 'fi'),
|
||||
fiji(value: 'fj'),
|
||||
france(value: 'fr'),
|
||||
micronesiaFederatedStatesOf(value: 'fm'),
|
||||
gabon(value: 'ga'),
|
||||
unitedKingdom(value: 'gb'),
|
||||
georgia(value: 'ge'),
|
||||
ghana(value: 'gh'),
|
||||
guinea(value: 'gn'),
|
||||
gambia(value: 'gm'),
|
||||
guineaBissau(value: 'gw'),
|
||||
equatorialGuinea(value: 'gq'),
|
||||
greece(value: 'gr'),
|
||||
grenada(value: 'gd'),
|
||||
guatemala(value: 'gt'),
|
||||
guyana(value: 'gy'),
|
||||
honduras(value: 'hn'),
|
||||
croatia(value: 'hr'),
|
||||
haiti(value: 'ht'),
|
||||
hungary(value: 'hu'),
|
||||
indonesia(value: 'id'),
|
||||
india(value: 'in'),
|
||||
ireland(value: 'ie'),
|
||||
iranIslamicRepublicOf(value: 'ir'),
|
||||
iraq(value: 'iq'),
|
||||
iceland(value: 'is'),
|
||||
israel(value: 'il'),
|
||||
italy(value: 'it'),
|
||||
jamaica(value: 'jm'),
|
||||
jordan(value: 'jo'),
|
||||
japan(value: 'jp'),
|
||||
kazakhstan(value: 'kz'),
|
||||
kenya(value: 'ke'),
|
||||
kyrgyzstan(value: 'kg'),
|
||||
cambodia(value: 'kh'),
|
||||
kiribati(value: 'ki'),
|
||||
saintKittsAndNevis(value: 'kn'),
|
||||
southKorea(value: 'kr'),
|
||||
kuwait(value: 'kw'),
|
||||
laoPeopleSDemocraticRepublic(value: 'la'),
|
||||
lebanon(value: 'lb'),
|
||||
liberia(value: 'lr'),
|
||||
libya(value: 'ly'),
|
||||
saintLucia(value: 'lc'),
|
||||
liechtenstein(value: 'li'),
|
||||
sriLanka(value: 'lk'),
|
||||
lesotho(value: 'ls'),
|
||||
lithuania(value: 'lt'),
|
||||
luxembourg(value: 'lu'),
|
||||
latvia(value: 'lv'),
|
||||
morocco(value: 'ma'),
|
||||
monaco(value: 'mc'),
|
||||
moldova(value: 'md'),
|
||||
madagascar(value: 'mg'),
|
||||
maldives(value: 'mv'),
|
||||
mexico(value: 'mx'),
|
||||
marshallIslands(value: 'mh'),
|
||||
northMacedonia(value: 'mk'),
|
||||
mali(value: 'ml'),
|
||||
malta(value: 'mt'),
|
||||
myanmar(value: 'mm'),
|
||||
montenegro(value: 'me'),
|
||||
mongolia(value: 'mn'),
|
||||
mozambique(value: 'mz'),
|
||||
mauritania(value: 'mr'),
|
||||
mauritius(value: 'mu'),
|
||||
malawi(value: 'mw'),
|
||||
malaysia(value: 'my'),
|
||||
namibia(value: 'na'),
|
||||
niger(value: 'ne'),
|
||||
nigeria(value: 'ng'),
|
||||
nicaragua(value: 'ni'),
|
||||
netherlands(value: 'nl'),
|
||||
norway(value: 'no'),
|
||||
nepal(value: 'np'),
|
||||
nauru(value: 'nr'),
|
||||
newZealand(value: 'nz'),
|
||||
oman(value: 'om'),
|
||||
pakistan(value: 'pk'),
|
||||
panama(value: 'pa'),
|
||||
peru(value: 'pe'),
|
||||
philippines(value: 'ph'),
|
||||
palau(value: 'pw'),
|
||||
papuaNewGuinea(value: 'pg'),
|
||||
poland(value: 'pl'),
|
||||
northKorea(value: 'kp'),
|
||||
portugal(value: 'pt'),
|
||||
paraguay(value: 'py'),
|
||||
qatar(value: 'qa'),
|
||||
romania(value: 'ro'),
|
||||
russia(value: 'ru'),
|
||||
rwanda(value: 'rw'),
|
||||
saudiArabia(value: 'sa'),
|
||||
sudan(value: 'sd'),
|
||||
senegal(value: 'sn'),
|
||||
singapore(value: 'sg'),
|
||||
solomonIslands(value: 'sb'),
|
||||
sierraLeone(value: 'sl'),
|
||||
elSalvador(value: 'sv'),
|
||||
sanMarino(value: 'sm'),
|
||||
somalia(value: 'so'),
|
||||
serbia(value: 'rs'),
|
||||
southSudan(value: 'ss'),
|
||||
saoTomeAndPrincipe(value: 'st'),
|
||||
suriname(value: 'sr'),
|
||||
slovakia(value: 'sk'),
|
||||
slovenia(value: 'si'),
|
||||
sweden(value: 'se'),
|
||||
eswatini(value: 'sz'),
|
||||
seychelles(value: 'sc'),
|
||||
syria(value: 'sy'),
|
||||
chad(value: 'td'),
|
||||
togo(value: 'tg'),
|
||||
thailand(value: 'th'),
|
||||
tajikistan(value: 'tj'),
|
||||
turkmenistan(value: 'tm'),
|
||||
timorLeste(value: 'tl'),
|
||||
tonga(value: 'to'),
|
||||
trinidadAndTobago(value: 'tt'),
|
||||
tunisia(value: 'tn'),
|
||||
turkey(value: 'tr'),
|
||||
tuvalu(value: 'tv'),
|
||||
tanzania(value: 'tz'),
|
||||
uganda(value: 'ug'),
|
||||
ukraine(value: 'ua'),
|
||||
uruguay(value: 'uy'),
|
||||
unitedStates(value: 'us'),
|
||||
uzbekistan(value: 'uz'),
|
||||
vaticanCity(value: 'va'),
|
||||
saintVincentAndTheGrenadines(value: 'vc'),
|
||||
venezuela(value: 've'),
|
||||
vietnam(value: 'vn'),
|
||||
vanuatu(value: 'vu'),
|
||||
samoa(value: 'ws'),
|
||||
yemen(value: 'ye'),
|
||||
southAfrica(value: 'za'),
|
||||
zambia(value: 'zm'),
|
||||
zimbabwe(value: 'zw');
|
||||
|
||||
const Flag({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum ImageFormat {
|
||||
jpg(value: 'jpg'),
|
||||
jpeg(value: 'jpeg'),
|
||||
gif(value: 'gif'),
|
||||
png(value: 'png'),
|
||||
webp(value: 'webp');
|
||||
|
||||
const ImageFormat({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum ImageGravity {
|
||||
center(value: 'center'),
|
||||
topLeft(value: 'top-left'),
|
||||
top(value: 'top'),
|
||||
topRight(value: 'top-right'),
|
||||
left(value: 'left'),
|
||||
right(value: 'right'),
|
||||
bottomLeft(value: 'bottom-left'),
|
||||
bottom(value: 'bottom'),
|
||||
bottomRight(value: 'bottom-right');
|
||||
|
||||
const ImageGravity({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
part of appwrite.enums;
|
||||
|
||||
enum OAuthProvider {
|
||||
amazon(value: 'amazon'),
|
||||
apple(value: 'apple'),
|
||||
auth0(value: 'auth0'),
|
||||
authentik(value: 'authentik'),
|
||||
autodesk(value: 'autodesk'),
|
||||
bitbucket(value: 'bitbucket'),
|
||||
bitly(value: 'bitly'),
|
||||
box(value: 'box'),
|
||||
dailymotion(value: 'dailymotion'),
|
||||
discord(value: 'discord'),
|
||||
disqus(value: 'disqus'),
|
||||
dropbox(value: 'dropbox'),
|
||||
etsy(value: 'etsy'),
|
||||
facebook(value: 'facebook'),
|
||||
github(value: 'github'),
|
||||
gitlab(value: 'gitlab'),
|
||||
google(value: 'google'),
|
||||
linkedin(value: 'linkedin'),
|
||||
microsoft(value: 'microsoft'),
|
||||
notion(value: 'notion'),
|
||||
oidc(value: 'oidc'),
|
||||
okta(value: 'okta'),
|
||||
paypal(value: 'paypal'),
|
||||
paypalSandbox(value: 'paypalSandbox'),
|
||||
podio(value: 'podio'),
|
||||
salesforce(value: 'salesforce'),
|
||||
slack(value: 'slack'),
|
||||
spotify(value: 'spotify'),
|
||||
stripe(value: 'stripe'),
|
||||
tradeshift(value: 'tradeshift'),
|
||||
tradeshiftBox(value: 'tradeshiftBox'),
|
||||
twitch(value: 'twitch'),
|
||||
wordpress(value: 'wordpress'),
|
||||
yahoo(value: 'yahoo'),
|
||||
yammer(value: 'yammer'),
|
||||
yandex(value: 'yandex'),
|
||||
zoho(value: 'zoho'),
|
||||
zoom(value: 'zoom'),
|
||||
mock(value: 'mock');
|
||||
|
||||
const OAuthProvider({
|
||||
required this.value
|
||||
});
|
||||
|
||||
final String value;
|
||||
|
||||
String toJson() => value;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class Document implements Model {
|
||||
$databaseId: map['\$databaseId'].toString(),
|
||||
$createdAt: map['\$createdAt'].toString(),
|
||||
$updatedAt: map['\$updatedAt'].toString(),
|
||||
$permissions: map['\$permissions'],
|
||||
$permissions: map['\$permissions'] ?? [],
|
||||
data: map,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class Execution implements Model {
|
||||
$id: map['\$id'].toString(),
|
||||
$createdAt: map['\$createdAt'].toString(),
|
||||
$updatedAt: map['\$updatedAt'].toString(),
|
||||
$permissions: map['\$permissions'],
|
||||
$permissions: map['\$permissions'] ?? [],
|
||||
functionId: map['functionId'].toString(),
|
||||
trigger: map['trigger'].toString(),
|
||||
status: map['status'].toString(),
|
||||
|
||||
@@ -45,7 +45,7 @@ class File implements Model {
|
||||
bucketId: map['bucketId'].toString(),
|
||||
$createdAt: map['\$createdAt'].toString(),
|
||||
$updatedAt: map['\$updatedAt'].toString(),
|
||||
$permissions: map['\$permissions'],
|
||||
$permissions: map['\$permissions'] ?? [],
|
||||
name: map['name'].toString(),
|
||||
signature: map['signature'].toString(),
|
||||
mimeType: map['mimeType'].toString(),
|
||||
|
||||
@@ -24,8 +24,6 @@ class Membership implements Model {
|
||||
final String joined;
|
||||
/// User confirmation status, true if the user has joined the team or false otherwise.
|
||||
final bool confirm;
|
||||
/// Multi factor authentication status, true if the user has MFA enabled or false otherwise.
|
||||
final bool mfa;
|
||||
/// User list of roles
|
||||
final List roles;
|
||||
|
||||
@@ -41,7 +39,6 @@ class Membership implements Model {
|
||||
required this.invited,
|
||||
required this.joined,
|
||||
required this.confirm,
|
||||
required this.mfa,
|
||||
required this.roles,
|
||||
});
|
||||
|
||||
@@ -58,8 +55,7 @@ class Membership implements Model {
|
||||
invited: map['invited'].toString(),
|
||||
joined: map['joined'].toString(),
|
||||
confirm: map['confirm'],
|
||||
mfa: map['mfa'],
|
||||
roles: map['roles'],
|
||||
roles: map['roles'] ?? [],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -76,7 +72,6 @@ class Membership implements Model {
|
||||
"invited": invited,
|
||||
"joined": joined,
|
||||
"confirm": confirm,
|
||||
"mfa": mfa,
|
||||
"roles": roles,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
part of appwrite.models;
|
||||
|
||||
/// MFA Challenge
|
||||
class MfaChallenge implements Model {
|
||||
/// Token ID.
|
||||
final String $id;
|
||||
/// Token creation date in ISO 8601 format.
|
||||
final String $createdAt;
|
||||
/// User ID.
|
||||
final String userId;
|
||||
/// Token expiration date in ISO 8601 format.
|
||||
final String expire;
|
||||
|
||||
MfaChallenge({
|
||||
required this.$id,
|
||||
required this.$createdAt,
|
||||
required this.userId,
|
||||
required this.expire,
|
||||
});
|
||||
|
||||
factory MfaChallenge.fromMap(Map<String, dynamic> map) {
|
||||
return MfaChallenge(
|
||||
$id: map['\$id'].toString(),
|
||||
$createdAt: map['\$createdAt'].toString(),
|
||||
userId: map['userId'].toString(),
|
||||
expire: map['expire'].toString(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"\$id": $id,
|
||||
"\$createdAt": $createdAt,
|
||||
"userId": userId,
|
||||
"expire": expire,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
part of appwrite.models;
|
||||
|
||||
/// MFAProvider
|
||||
class MfaProvider implements Model {
|
||||
/// Backup codes.
|
||||
final List backups;
|
||||
/// Secret token used for TOTP factor.
|
||||
final String secret;
|
||||
/// URI for authenticator apps.
|
||||
final String uri;
|
||||
|
||||
MfaProvider({
|
||||
required this.backups,
|
||||
required this.secret,
|
||||
required this.uri,
|
||||
});
|
||||
|
||||
factory MfaProvider.fromMap(Map<String, dynamic> map) {
|
||||
return MfaProvider(
|
||||
backups: map['backups'],
|
||||
secret: map['secret'].toString(),
|
||||
uri: map['uri'].toString(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"backups": backups,
|
||||
"secret": secret,
|
||||
"uri": uri,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
part of appwrite.models;
|
||||
|
||||
/// MFAProviders
|
||||
class MfaProviders implements Model {
|
||||
/// TOTP
|
||||
final bool totp;
|
||||
/// Phone
|
||||
final bool phone;
|
||||
/// Email
|
||||
final bool email;
|
||||
|
||||
MfaProviders({
|
||||
required this.totp,
|
||||
required this.phone,
|
||||
required this.email,
|
||||
});
|
||||
|
||||
factory MfaProviders.fromMap(Map<String, dynamic> map) {
|
||||
return MfaProviders(
|
||||
totp: map['totp'],
|
||||
phone: map['phone'],
|
||||
email: map['email'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"totp": totp,
|
||||
"phone": phone,
|
||||
"email": email,
|
||||
};
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user