feat: update for 1.0.0-RC1

This commit is contained in:
Christy Jacob
2022-09-05 01:49:58 +04:00
parent 23d2a2aff3
commit 5d16e8d9d3
56 changed files with 324 additions and 308 deletions
+3 -5
View File
@@ -1,5 +1,3 @@
dist: focal
language: dart
dart: stable
@@ -7,9 +5,9 @@ dart: stable
os: linux
install:
- mkdir -p ~/.pub-cache
- mkdir -p ~/.config/dart
- |
cat <<EOF > ~/.pub-cache/credentials.json
cat <<EOF > ~/.config/dart/pub-credentials.json
{
"accessToken":"$PUB_ACCESS_TOKEN",
"refreshToken":"$PUB_REFRESH_TOKEN",
@@ -23,4 +21,4 @@ deploy:
skip_cleanup: true
script: dart format ./lib/ && dart pub publish -f
on:
tags: true
tags: true
+3 -3
View File
@@ -2,12 +2,12 @@
[![pub package](https://img.shields.io/pub/v/appwrite?style=flat-square)](https://pub.dartlang.org/packages/appwrite)
![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-0.15.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.0.0-RC1-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
**This SDK is compatible with Appwrite server version 0.15.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.0.0-RC1. 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: ^7.0.0
appwrite: ^8.0.0-dev.1
```
You can install packages from the command line:
@@ -10,7 +10,7 @@ void main() { // Init SDK
;
Future result = account.createPhoneSession(
userId: '[USER_ID]',
number: '',
phone: '',
);
result
+1 -1
View File
@@ -9,7 +9,7 @@ void main() { // Init SDK
.setProject('5df5acd0d48c2') // Your project ID
;
Future result = account.updatePhone(
number: '',
phone: '',
password: 'password',
);
+2 -1
View File
@@ -2,13 +2,14 @@ import 'package:appwrite/appwrite.dart';
void main() { // Init SDK
Client client = Client();
Databases databases = Databases(client, databaseId: '[DATABASE_ID]');
Databases databases = Databases(client);
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
Future result = databases.createDocument(
databaseId: '[DATABASE_ID]',
collectionId: '[COLLECTION_ID]',
documentId: '[DOCUMENT_ID]',
data: {},
+2 -1
View File
@@ -2,13 +2,14 @@ import 'package:appwrite/appwrite.dart';
void main() { // Init SDK
Client client = Client();
Databases databases = Databases(client, databaseId: '[DATABASE_ID]');
Databases databases = Databases(client);
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
Future result = databases.deleteDocument(
databaseId: '[DATABASE_ID]',
collectionId: '[COLLECTION_ID]',
documentId: '[DOCUMENT_ID]',
);
+2 -1
View File
@@ -2,13 +2,14 @@ import 'package:appwrite/appwrite.dart';
void main() { // Init SDK
Client client = Client();
Databases databases = Databases(client, databaseId: '[DATABASE_ID]');
Databases databases = Databases(client);
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
Future result = databases.getDocument(
databaseId: '[DATABASE_ID]',
collectionId: '[COLLECTION_ID]',
documentId: '[DOCUMENT_ID]',
);
+2 -1
View File
@@ -2,13 +2,14 @@ import 'package:appwrite/appwrite.dart';
void main() { // Init SDK
Client client = Client();
Databases databases = Databases(client, databaseId: '[DATABASE_ID]');
Databases databases = Databases(client);
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
Future result = databases.listDocuments(
databaseId: '[DATABASE_ID]',
collectionId: '[COLLECTION_ID]',
);
+2 -1
View File
@@ -2,13 +2,14 @@ import 'package:appwrite/appwrite.dart';
void main() { // Init SDK
Client client = Client();
Databases databases = Databases(client, databaseId: '[DATABASE_ID]');
Databases databases = Databases(client);
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
Future result = databases.updateDocument(
databaseId: '[DATABASE_ID]',
collectionId: '[COLLECTION_ID]',
documentId: '[DOCUMENT_ID]',
);
+3
View File
@@ -19,6 +19,9 @@ export 'src/realtime_message.dart';
export 'src/input_file.dart';
part 'query.dart';
part 'permission.dart';
part 'role.dart';
part 'id.dart';
part 'services/account.dart';
part 'services/avatars.dart';
part 'services/databases.dart';
+11
View File
@@ -0,0 +1,11 @@
part of appwrite;
class ID {
static String unique() {
return 'unique()';
}
static String custom(String id) {
return id;
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ part 'src/models/currency_list.dart';
part 'src/models/phone_list.dart';
part 'src/models/document.dart';
part 'src/models/log.dart';
part 'src/models/user.dart';
part 'src/models/account.dart';
part 'src/models/preferences.dart';
part 'src/models/session.dart';
part 'src/models/token.dart';
+19
View File
@@ -0,0 +1,19 @@
part of appwrite;
class Permission {
static String read(String role) {
return 'read("$role")';
}
static String write(String role) {
return 'write("$role")';
}
static String create(String role) {
return 'create("$role")';
}
static String update(String role) {
return 'update("$role")';
}
static String delete(String role) {
return 'delete("$role")';
}
}
+23 -11
View File
@@ -7,25 +7,37 @@ class Query {
static notEqual(String attribute, dynamic value) =>
_addQuery(attribute, 'notEqual', value);
static lesser(String attribute, dynamic value) =>
_addQuery(attribute, 'lesser', value);
static lessThan(String attribute, dynamic value) =>
_addQuery(attribute, 'lessThan', value);
static lesserEqual(String attribute, dynamic value) =>
_addQuery(attribute, 'lesserEqual', value);
static lessThanEqual(String attribute, dynamic value) =>
_addQuery(attribute, 'lessThanEqual', value);
static greater(String attribute, dynamic value) =>
_addQuery(attribute, 'greater', value);
static greaterThan(String attribute, dynamic value) =>
_addQuery(attribute, 'greaterThan', value);
static greaterEqual(String attribute, dynamic value) =>
_addQuery(attribute, 'greaterEqual', value);
static greaterThanEqual(String attribute, dynamic value) =>
_addQuery(attribute, 'greaterThanEqual', value);
static search(String attribute, String value) =>
_addQuery(attribute, 'search', value);
static String _addQuery(String attribute, String oper, dynamic value) => (value
static String orderAsc(String attribute) => 'orderAsc("$attribute")';
static String orderDesc(String attribute) => 'orderDesc("$attribute")';
static String cursorBefore(String id) => 'cursorBefore("$id")';
static String cursorAfter(String id) => 'cursorAfter("$id")';
static String limit(int limit) => 'limit($limit)';
static String offset(int offset) => 'offset($offset)';
static String _addQuery(String attribute, String method, dynamic value) => (value
is List)
? '$attribute.$oper(${value.map((item) => parseValues(item)).join(",")})'
: '$attribute.$oper(${parseValues(value)})';
? '$method("$attribute", [${value.map((item) => parseValues(item)).join(",")}])'
: '$method("$attribute", [${parseValues(value)}])';
static String parseValues(dynamic value) =>
(value is String) ? '"$value"' : '$value';
+30
View File
@@ -0,0 +1,30 @@
part of appwrite;
class Role {
static String any() {
return 'any';
}
static String user(String id) {
return 'user:$id';
}
static String users() {
return 'users';
}
static String guests() {
return 'guests';
}
static String team(String id, [String role = '']) {
if(role.isEmpty) {
return 'team:$id';
}
return 'team:$id/$role';
}
static String status(String status) {
return 'status:$status';
}
}
+28 -28
View File
@@ -2,13 +2,13 @@ part of appwrite;
/// The Account service allows you to authenticate and manage a user account.
class Account extends Service {
Account(Client client): super(client);
Account(super.client);
/// Get Account
///
/// Get currently logged in user data as JSON object.
///
Future<models.User> get() async {
Future<models.Account> get() async {
const String path = '/account';
final Map<String, dynamic> params = {
@@ -20,7 +20,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.get, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
@@ -33,7 +33,7 @@ class Account extends Service {
/// login to their new account, you need to create a new [account
/// session](/docs/client/account#accountCreateSession).
///
Future<models.User> create({required String userId, required String email, required String password, String? name}) async {
Future<models.Account> create({required String userId, required String email, required String password, String? name}) async {
const String path = '/account';
final Map<String, dynamic> params = {
@@ -49,7 +49,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
@@ -64,7 +64,7 @@ class Account extends Service {
/// one, by passing an email address and a new password.
///
///
Future<models.User> updateEmail({required String email, required String password}) async {
Future<models.Account> updateEmail({required String email, required String password}) async {
const String path = '/account/email';
final Map<String, dynamic> params = {
@@ -78,7 +78,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
@@ -111,12 +111,11 @@ class Account extends Service {
/// Get currently logged in user list of latest security activity logs. Each
/// log returns user IP address, location and date and time of log.
///
Future<models.LogList> getLogs({int? limit, int? offset}) async {
Future<models.LogList> getLogs({List<String>? queries}) async {
const String path = '/account/logs';
final Map<String, dynamic> params = {
'limit': limit,
'offset': offset,
'queries': queries,
};
final Map<String, String> headers = {
@@ -133,7 +132,7 @@ class Account extends Service {
///
/// Update currently logged in user account name.
///
Future<models.User> updateName({required String name}) async {
Future<models.Account> updateName({required String name}) async {
const String path = '/account/name';
final Map<String, dynamic> params = {
@@ -146,7 +145,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
@@ -156,7 +155,7 @@ class Account extends Service {
/// to pass in the new password, and the old password. For users created with
/// OAuth, Team Invites and Magic URL, oldPassword is optional.
///
Future<models.User> updatePassword({required String password, String? oldPassword}) async {
Future<models.Account> updatePassword({required String password, String? oldPassword}) async {
const String path = '/account/password';
final Map<String, dynamic> params = {
@@ -170,7 +169,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
@@ -182,11 +181,11 @@ class Account extends Service {
/// /account/verification/phone](/docs/client/account#accountCreatePhoneVerification)
/// endpoint to send a confirmation SMS.
///
Future<models.User> updatePhone({required String number, required String password}) async {
Future<models.Account> updatePhone({required String phone, required String password}) async {
const String path = '/account/phone';
final Map<String, dynamic> params = {
'number': number,
'phone': phone,
'password': password,
};
@@ -196,7 +195,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
@@ -226,7 +225,7 @@ class Account extends Service {
/// stored as is, and replaces any previous value. The maximum allowed prefs
/// size is 64kB and throws error if exceeded.
///
Future<models.User> updatePrefs({required Map prefs}) async {
Future<models.Account> updatePrefs({required Map prefs}) async {
const String path = '/account/prefs';
final Map<String, dynamic> params = {
@@ -239,7 +238,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
@@ -396,9 +395,10 @@ class Account extends Service {
/// Create Magic URL session
///
/// Sends the user an email with a secret key for creating a session. 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
/// 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. 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](/docs/client/account#accountUpdateMagicURLSession)
@@ -473,7 +473,7 @@ class Account extends Service {
/// user..
///
///
Future createOAuth2Session({required String provider, String? success, String? failure, List? scopes}) async {
Future createOAuth2Session({required String provider, String? success, String? failure, List<String>? scopes}) async {
final String path = '/account/sessions/oauth2/{provider}'.replaceAll('{provider}', provider);
final Map<String, dynamic> params = {
@@ -517,12 +517,12 @@ class Account extends Service {
/// endpoint to complete the login process. The secret sent to the user's phone
/// is valid for 15 minutes.
///
Future<models.Token> createPhoneSession({required String userId, required String number}) async {
Future<models.Token> createPhoneSession({required String userId, required String phone}) async {
const String path = '/account/sessions/phone';
final Map<String, dynamic> params = {
'userId': userId,
'number': number,
'phone': phone,
};
final Map<String, String> headers = {
@@ -535,7 +535,7 @@ class Account extends Service {
}
/// Create Phone session (confirmation)
/// Create Phone Session (confirmation)
///
/// Use this endpoint to complete creating a session with SMS. Use the
/// **userId** from the
@@ -633,7 +633,7 @@ class Account extends Service {
/// record is not deleted but permanently blocked from any access. To
/// completely delete a user, use the Users API instead.
///
Future<models.User> updateStatus() async {
Future<models.Account> updateStatus() async {
const String path = '/account/status';
final Map<String, dynamic> params = {
@@ -645,7 +645,7 @@ class Account extends Service {
final res = await client.call(HttpMethod.patch, path: path, params: params, headers: headers);
return models.User.fromMap(res.data);
return models.Account.fromMap(res.data);
}
+3 -2
View File
@@ -3,7 +3,7 @@ part of appwrite;
/// The Avatars service aims to help you complete everyday tasks related to
/// your app image, icons, and avatars.
class Avatars extends Service {
Avatars(Client client): super(client);
Avatars(super.client);
/// Get Browser Icon
///
@@ -85,7 +85,8 @@ class Avatars extends Service {
///
/// You can use this endpoint to show different country flags icons to your
/// users. The code argument receives the 2 letter country code. Use width,
/// height and quality arguments to change the output settings.
/// height and quality arguments to change the output settings. Country codes
/// follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard.
///
/// When one dimension is specified and the other is 0, the image is scaled
/// with preserved aspect ratio. If both dimensions are 0, the API provides an
+31 -17
View File
@@ -3,21 +3,20 @@ part of appwrite;
/// The Databases service allows you to create structured collections of
/// documents, query and filter lists of documents
class Databases extends Service {
Databases(Client client, {required this.databaseId}): super(client);
String databaseId;
Databases(super.client);
/// List Documents
Future<models.DocumentList> listDocuments({required String collectionId, List? queries, int? limit, int? offset, String? cursor, String? cursorDirection, List? orderAttributes, List? orderTypes}) async {
///
/// Get a list of all the user's documents in a given collection. You can use
/// the query params to filter your results. On admin mode, this endpoint will
/// return a list of all of documents belonging to the provided collectionId.
/// [Learn more about different API modes](/docs/admin).
///
Future<models.DocumentList> listDocuments({required String databaseId, required String collectionId, List<String>? queries}) async {
final String path = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId);
final Map<String, dynamic> params = {
'queries': queries,
'limit': limit,
'offset': offset,
'cursor': cursor,
'cursorDirection': cursorDirection,
'orderAttributes': orderAttributes,
'orderTypes': orderTypes,
};
final Map<String, String> headers = {
@@ -31,14 +30,19 @@ class Databases extends Service {
}
/// Create Document
Future<models.Document> createDocument({required String collectionId, required String documentId, required Map data, List? read, List? write}) async {
///
/// Create a new Document. Before using this route, you should create a new
/// collection resource using either a [server
/// integration](/docs/server/databases#databasesCreateCollection) API or
/// directly from your database console.
///
Future<models.Document> createDocument({required String databaseId, required String collectionId, required String documentId, required Map data, List<String>? permissions}) async {
final String path = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId);
final Map<String, dynamic> params = {
'documentId': documentId,
'data': data,
'read': read,
'write': write,
'permissions': permissions,
};
final Map<String, String> headers = {
@@ -52,7 +56,11 @@ class Databases extends Service {
}
/// Get Document
Future<models.Document> getDocument({required String collectionId, required String documentId}) async {
///
/// Get a document by its unique ID. This endpoint response returns a JSON
/// object with the document data.
///
Future<models.Document> getDocument({required String databaseId, required String collectionId, required String documentId}) async {
final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId);
final Map<String, dynamic> params = {
@@ -69,13 +77,16 @@ class Databases extends Service {
}
/// Update Document
Future<models.Document> updateDocument({required String collectionId, required String documentId, Map? data, List? read, List? write}) async {
///
/// Update a document by its unique ID. Using the patch method you can pass
/// only specific fields that will get updated.
///
Future<models.Document> updateDocument({required String databaseId, required String collectionId, required String documentId, Map? data, List<String>? permissions}) async {
final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId);
final Map<String, dynamic> params = {
'data': data,
'read': read,
'write': write,
'permissions': permissions,
};
final Map<String, String> headers = {
@@ -89,7 +100,10 @@ class Databases extends Service {
}
/// Delete Document
Future deleteDocument({required String collectionId, required String documentId}) async {
///
/// Delete a document by its unique ID.
///
Future deleteDocument({required String databaseId, required String collectionId, required String documentId}) async {
final String path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId);
final Map<String, dynamic> params = {
+3 -6
View File
@@ -3,7 +3,7 @@ part of appwrite;
/// The Functions Service allows you view, create and manage your Cloud
/// Functions.
class Functions extends Service {
Functions(Client client): super(client);
Functions(super.client);
/// Retry Build
Future retryBuild({required String functionId, required String deploymentId, required String buildId}) async {
@@ -29,15 +29,12 @@ class Functions extends Service {
/// return a list of all of the project's executions. [Learn more about
/// different API modes](/docs/admin).
///
Future<models.ExecutionList> listExecutions({required String functionId, int? limit, int? offset, String? search, String? cursor, String? cursorDirection}) async {
Future<models.ExecutionList> listExecutions({required String functionId, List<String>? queries, String? search}) async {
final String path = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId);
final Map<String, dynamic> params = {
'limit': limit,
'offset': offset,
'queries': queries,
'search': search,
'cursor': cursor,
'cursorDirection': cursorDirection,
};
final Map<String, String> headers = {
+1 -1
View File
@@ -3,7 +3,7 @@ part of appwrite;
/// The Locale service allows you to customize your app based on your users'
/// location.
class Locale extends Service {
Locale(Client client): super(client);
Locale(super.client);
/// Get User Locale
///
+9 -15
View File
@@ -2,7 +2,7 @@ part of appwrite;
/// The Storage service allows you to manage your project files.
class Storage extends Service {
Storage(Client client): super(client);
Storage(super.client);
/// List Files
///
@@ -10,16 +10,12 @@ class Storage extends Service {
/// your results. On admin mode, this endpoint will return a list of all of the
/// project's files. [Learn more about different API modes](/docs/admin).
///
Future<models.FileList> listFiles({required String bucketId, String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
Future<models.FileList> listFiles({required String bucketId, List<String>? queries, String? search}) async {
final String path = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId);
final Map<String, dynamic> params = {
'queries': queries,
'search': search,
'limit': limit,
'offset': offset,
'cursor': cursor,
'cursorDirection': cursorDirection,
'orderType': orderType,
};
final Map<String, String> headers = {
@@ -36,8 +32,8 @@ class Storage extends Service {
///
/// Create a new file. Before using this route, you should create a new bucket
/// resource using either a [server
/// integration](/docs/server/database#storageCreateBucket) API or directly
/// from your Appwrite console.
/// integration](/docs/server/storage#storageCreateBucket) API or directly from
/// your Appwrite console.
///
/// Larger files should be uploaded using multiple requests with the
/// [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
@@ -53,7 +49,7 @@ class Storage extends Service {
/// chunking logic will be managed by the SDK internally.
///
///
Future<models.File> createFile({required String bucketId, required String fileId, required InputFile file, List? read, List? write, Function(UploadProgress)? onProgress}) async {
Future<models.File> createFile({required String bucketId, required String fileId, required InputFile file, List<String>? permissions, Function(UploadProgress)? onProgress}) async {
final String path = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId);
final Map<String, dynamic> params = {
@@ -61,8 +57,7 @@ class Storage extends Service {
'fileId': fileId,
'file': file,
'read': read,
'write': write,
'permissions': permissions,
};
final Map<String, String> headers = {
@@ -111,12 +106,11 @@ class Storage extends Service {
/// Update a file by its unique ID. Only users with write permissions have
/// access to update this resource.
///
Future<models.File> updateFile({required String bucketId, required String fileId, List? read, List? write}) async {
Future<models.File> updateFile({required String bucketId, required String fileId, List<String>? permissions}) async {
final String path = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId);
final Map<String, dynamic> params = {
'read': read,
'write': write,
'permissions': permissions,
};
final Map<String, String> headers = {
+8 -16
View File
@@ -3,7 +3,7 @@ part of appwrite;
/// The Teams service allows you to group users of your project and to enable
/// them to share read and write access to your project resources
class Teams extends Service {
Teams(Client client): super(client);
Teams(super.client);
/// List Teams
///
@@ -13,16 +13,12 @@ class Teams extends Service {
/// In admin mode, this endpoint returns a list of all the teams in the current
/// project. [Learn more about different API modes](/docs/admin).
///
Future<models.TeamList> list({String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
Future<models.TeamList> list({List<String>? queries, String? search}) async {
const String path = '/teams';
final Map<String, dynamic> params = {
'queries': queries,
'search': search,
'limit': limit,
'offset': offset,
'cursor': cursor,
'cursorDirection': cursorDirection,
'orderType': orderType,
};
final Map<String, String> headers = {
@@ -41,7 +37,7 @@ class Teams extends Service {
/// assigned as the owner of the team. Only the users with the owner role can
/// invite new members, add new owners and delete or update the team.
///
Future<models.Team> create({required String teamId, required String name, List? roles}) async {
Future<models.Team> create({required String teamId, required String name, List<String>? roles}) async {
const String path = '/teams';
final Map<String, dynamic> params = {
@@ -128,16 +124,12 @@ class Teams extends Service {
/// Use this endpoint to list a team's members using the team's ID. All team
/// members have read access to this endpoint.
///
Future<models.MembershipList> getMemberships({required String teamId, String? search, int? limit, int? offset, String? cursor, String? cursorDirection, String? orderType}) async {
Future<models.MembershipList> getMemberships({required String teamId, List<String>? queries, String? search}) async {
final String path = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId);
final Map<String, dynamic> params = {
'queries': queries,
'search': search,
'limit': limit,
'offset': offset,
'cursor': cursor,
'cursorDirection': cursorDirection,
'orderType': orderType,
};
final Map<String, String> headers = {
@@ -168,7 +160,7 @@ class Teams extends Service {
/// the only valid redirect URL's are the once from domains you have set when
/// adding your platforms in the console interface.
///
Future<models.Membership> createMembership({required String teamId, required String email, required List roles, required String url, String? name}) async {
Future<models.Membership> createMembership({required String teamId, required String email, required List<String> roles, required String url, String? name}) async {
final String path = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId);
final Map<String, dynamic> params = {
@@ -215,7 +207,7 @@ class Teams extends Service {
/// have access to this endpoint. Learn more about [roles and
/// permissions](/docs/permissions).
///
Future<models.Membership> updateMembershipRoles({required String teamId, required String membershipId, required List roles}) async {
Future<models.Membership> updateMembershipRoles({required String teamId, required String membershipId, required List<String> roles}) async {
final String path = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId);
final Map<String, dynamic> params = {
+5 -2
View File
@@ -40,8 +40,11 @@ class ClientBrowser extends ClientBase with ClientMixin {
.replaceFirst('http://', 'ws://');
_headers = {
'content-type': 'application/json',
'x-sdk-version': 'appwrite:flutter:7.0.0',
'X-Appwrite-Response-Format' : '0.15.0',
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '8.0.0-dev.1',
'X-Appwrite-Response-Format' : '1.0.0-RC1',
};
config = {};
+6 -3
View File
@@ -49,7 +49,7 @@ class ClientIO extends ClientBase with ClientMixin {
String? get endPointRealtime => _endPointRealtime;
ClientIO({
String endPoint = 'https://appwrite.io/v1',
String endPoint = 'https://HOSTNAME/v1',
this.selfSigned = false,
}) : _endPoint = endPoint {
_nativeClient = HttpClient()
@@ -61,8 +61,11 @@ class ClientIO extends ClientBase with ClientMixin {
.replaceFirst('http://', 'ws://');
_headers = {
'content-type': 'application/json',
'x-sdk-version': 'appwrite:flutter:7.0.0',
'X-Appwrite-Response-Format' : '0.15.0',
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '8.0.0-dev.1',
'X-Appwrite-Response-Format' : '1.0.0-RC1',
};
config = {};
+2 -2
View File
@@ -1,11 +1,11 @@
class AppwriteException implements Exception {
final String? message;
final int? code;
final String? type;
final int? code;
final dynamic response;
AppwriteException([this.message = "", this.code, this.type, this.response]);
@override
String toString() {
if (message == null) return "AppwriteException";
+2 -5
View File
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'exception.dart';
class InputFile {
@@ -10,10 +9,8 @@ class InputFile {
/// Provide a file, use `path` for IO platforms
/// and provide `bytes` for web platform
InputFile({this.path, this.filename, this.contentType, this.bytes}) {
if (kIsWeb && bytes == null) {
throw AppwriteException('On web `bytes` is required');
} else if(!kIsWeb && path == null && bytes == null) {
throw AppwriteException('On IO platforms one of `path` or `bytes` is required');
if (path == null && bytes == null) {
throw AppwriteException('One of `path` or `bytes` is required');
}
}
}
@@ -1,21 +1,21 @@
part of appwrite.models;
/// User
class User implements Model {
/// Account
class Account implements Model {
/// User ID.
final String $id;
/// User creation date in Unix timestamp.
final int $createdAt;
/// User update date in Unix timestamp.
final int $updatedAt;
/// User creation date in ISO 8601 format.
final String $createdAt;
/// User update date in ISO 8601 format.
final String $updatedAt;
/// User name.
final String name;
/// User registration date in Unix timestamp.
final int registration;
/// User registration date in ISO 8601 format.
final String registration;
/// User status. Pass `true` for enabled and `false` for disabled.
final bool status;
/// Unix timestamp of the most recent password update
final int passwordUpdate;
/// Password update time in ISO 8601 format.
final String passwordUpdate;
/// User email address.
final String email;
/// User phone number in E.164 format.
@@ -27,8 +27,7 @@ class User implements Model {
/// User preferences as a key-value object
final Preferences prefs;
User({
required this.$id,
Account({ required this.$id,
required this.$createdAt,
required this.$updatedAt,
required this.name,
@@ -42,15 +41,15 @@ class User implements Model {
required this.prefs,
});
factory User.fromMap(Map<String, dynamic> map) {
return User(
factory Account.fromMap(Map<String, dynamic> map) {
return Account(
$id: map['\$id'].toString(),
$createdAt: map['\$createdAt'],
$updatedAt: map['\$updatedAt'],
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
name: map['name'].toString(),
registration: map['registration'],
registration: map['registration'].toString(),
status: map['status'],
passwordUpdate: map['passwordUpdate'],
passwordUpdate: map['passwordUpdate'].toString(),
email: map['email'].toString(),
phone: map['phone'].toString(),
emailVerification: map['emailVerification'],
@@ -59,7 +58,6 @@ class User implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
+1 -3
View File
@@ -7,8 +7,7 @@ class Continent implements Model {
/// Continent two letter code.
final String code;
Continent({
required this.name,
Continent({ required this.name,
required this.code,
});
@@ -19,7 +18,6 @@ class Continent implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"name": name,
+1 -3
View File
@@ -7,8 +7,7 @@ class ContinentList implements Model {
/// List of continents.
final List<Continent> continents;
ContinentList({
required this.total,
ContinentList({ required this.total,
required this.continents,
});
@@ -19,7 +18,6 @@ class ContinentList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+1 -3
View File
@@ -7,8 +7,7 @@ class Country implements Model {
/// Country two-character ISO 3166-1 alpha code.
final String code;
Country({
required this.name,
Country({ required this.name,
required this.code,
});
@@ -19,7 +18,6 @@ class Country implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"name": name,
+1 -3
View File
@@ -7,8 +7,7 @@ class CountryList implements Model {
/// List of countries.
final List<Country> countries;
CountryList({
required this.total,
CountryList({ required this.total,
required this.countries,
});
@@ -19,7 +18,6 @@ class CountryList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+1 -3
View File
@@ -17,8 +17,7 @@ class Currency implements Model {
/// Currency plural name
final String namePlural;
Currency({
required this.symbol,
Currency({ required this.symbol,
required this.name,
required this.symbolNative,
required this.decimalDigits,
@@ -39,7 +38,6 @@ class Currency implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"symbol": symbol,
+1 -3
View File
@@ -7,8 +7,7 @@ class CurrencyList implements Model {
/// List of currencies.
final List<Currency> currencies;
CurrencyList({
required this.total,
CurrencyList({ required this.total,
required this.currencies,
});
@@ -19,7 +18,6 @@ class CurrencyList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+12 -19
View File
@@ -6,23 +6,19 @@ class Document implements Model {
final String $id;
/// Collection ID.
final String $collection;
/// Document creation date in Unix timestamp.
final int $createdAt;
/// Document update date in Unix timestamp.
final int $updatedAt;
/// Document read permissions.
final List $read;
/// Document write permissions.
final List $write;
/// Document creation date in ISO 8601 format.
final String $createdAt;
/// Document update date in ISO 8601 format.
final String $updatedAt;
/// Document permissions. [Learn more about permissions](/docs/permissions).
final List $permissions;
final Map<String, dynamic> data;
Document({
required this.$id,
Document({ required this.$id,
required this.$collection,
required this.$createdAt,
required this.$updatedAt,
required this.$read,
required this.$write,
required this.$permissions,
required this.data,
});
@@ -30,23 +26,20 @@ class Document implements Model {
return Document(
$id: map['\$id'].toString(),
$collection: map['\$collection'].toString(),
$createdAt: map['\$createdAt'],
$updatedAt: map['\$updatedAt'],
$read: map['\$read'],
$write: map['\$write'],
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
$permissions: map['\$permissions'],
data: map,
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
"\$collection": $collection,
"\$createdAt": $createdAt,
"\$updatedAt": $updatedAt,
"\$read": $read,
"\$write": $write,
"\$permissions": $permissions,
"data": data,
};
}
+1 -3
View File
@@ -7,8 +7,7 @@ class DocumentList implements Model {
/// List of documents.
final List<Document> documents;
DocumentList({
required this.total,
DocumentList({ required this.total,
required this.documents,
});
@@ -19,7 +18,6 @@ class DocumentList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+18 -15
View File
@@ -4,12 +4,12 @@ part of appwrite.models;
class Execution implements Model {
/// Execution ID.
final String $id;
/// Execution creation date in Unix timestamp.
final int $createdAt;
/// Execution update date in Unix timestamp.
final int $updatedAt;
/// Execution read permissions.
final List $read;
/// Execution creation date in ISO 8601 format.
final String $createdAt;
/// Execution upate date in ISO 8601 format.
final String $updatedAt;
/// Execution roles.
final List $permissions;
/// Function ID.
final String functionId;
/// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.
@@ -20,21 +20,23 @@ class Execution implements Model {
final int statusCode;
/// The script response output string. Logs the last 4,000 characters of the execution response output.
final String response;
/// The script stderr output string. Logs the last 4,000 characters of the execution stderr output
/// The script stdout output string. Logs the last 4,000 characters of the execution stdout output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
final String stdout;
/// The script stderr output string. Logs the last 4,000 characters of the execution stderr output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
final String stderr;
/// The script execution time in seconds.
final double time;
Execution({
required this.$id,
Execution({ required this.$id,
required this.$createdAt,
required this.$updatedAt,
required this.$read,
required this.$permissions,
required this.functionId,
required this.trigger,
required this.status,
required this.statusCode,
required this.response,
required this.stdout,
required this.stderr,
required this.time,
});
@@ -42,31 +44,32 @@ class Execution implements Model {
factory Execution.fromMap(Map<String, dynamic> map) {
return Execution(
$id: map['\$id'].toString(),
$createdAt: map['\$createdAt'],
$updatedAt: map['\$updatedAt'],
$read: map['\$read'],
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
$permissions: map['\$permissions'],
functionId: map['functionId'].toString(),
trigger: map['trigger'].toString(),
status: map['status'].toString(),
statusCode: map['statusCode'],
response: map['response'].toString(),
stdout: map['stdout'].toString(),
stderr: map['stderr'].toString(),
time: map['time'].toDouble(),
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
"\$createdAt": $createdAt,
"\$updatedAt": $updatedAt,
"\$read": $read,
"\$permissions": $permissions,
"functionId": functionId,
"trigger": trigger,
"status": status,
"statusCode": statusCode,
"response": response,
"stdout": stdout,
"stderr": stderr,
"time": time,
};
+1 -3
View File
@@ -7,8 +7,7 @@ class ExecutionList implements Model {
/// List of executions.
final List<Execution> executions;
ExecutionList({
required this.total,
ExecutionList({ required this.total,
required this.executions,
});
@@ -19,7 +18,6 @@ class ExecutionList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+12 -19
View File
@@ -6,14 +6,12 @@ class File implements Model {
final String $id;
/// Bucket ID.
final String bucketId;
/// File creation date in Unix timestamp.
final int $createdAt;
/// File update date in Unix timestamp.
final int $updatedAt;
/// File read permissions.
final List $read;
/// File write permissions.
final List $write;
/// File creation date in ISO 8601 format.
final String $createdAt;
/// File update date in ISO 8601 format.
final String $updatedAt;
/// File permissions. [Learn more about permissions](/docs/permissions).
final List $permissions;
/// File name.
final String name;
/// File MD5 signature.
@@ -27,13 +25,11 @@ class File implements Model {
/// Total number of chunks uploaded
final int chunksUploaded;
File({
required this.$id,
File({ required this.$id,
required this.bucketId,
required this.$createdAt,
required this.$updatedAt,
required this.$read,
required this.$write,
required this.$permissions,
required this.name,
required this.signature,
required this.mimeType,
@@ -46,10 +42,9 @@ class File implements Model {
return File(
$id: map['\$id'].toString(),
bucketId: map['bucketId'].toString(),
$createdAt: map['\$createdAt'],
$updatedAt: map['\$updatedAt'],
$read: map['\$read'],
$write: map['\$write'],
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
$permissions: map['\$permissions'],
name: map['name'].toString(),
signature: map['signature'].toString(),
mimeType: map['mimeType'].toString(),
@@ -59,15 +54,13 @@ class File implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
"bucketId": bucketId,
"\$createdAt": $createdAt,
"\$updatedAt": $updatedAt,
"\$read": $read,
"\$write": $write,
"\$permissions": $permissions,
"name": name,
"signature": signature,
"mimeType": mimeType,
+1 -3
View File
@@ -7,8 +7,7 @@ class FileList implements Model {
/// List of files.
final List<File> files;
FileList({
required this.total,
FileList({ required this.total,
required this.files,
});
@@ -19,7 +18,6 @@ class FileList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+1 -3
View File
@@ -5,8 +5,7 @@ class Jwt implements Model {
/// JWT encoded string.
final String jwt;
Jwt({
required this.jwt,
Jwt({ required this.jwt,
});
factory Jwt.fromMap(Map<String, dynamic> map) {
@@ -15,7 +14,6 @@ class Jwt implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"jwt": jwt,
+1 -3
View File
@@ -9,8 +9,7 @@ class Language implements Model {
/// Language native name.
final String nativeName;
Language({
required this.name,
Language({ required this.name,
required this.code,
required this.nativeName,
});
@@ -23,7 +22,6 @@ class Language implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"name": name,
+1 -3
View File
@@ -7,8 +7,7 @@ class LanguageList implements Model {
/// List of languages.
final List<Language> languages;
LanguageList({
required this.total,
LanguageList({ required this.total,
required this.languages,
});
@@ -19,7 +18,6 @@ class LanguageList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+1 -3
View File
@@ -17,8 +17,7 @@ class Locale implements Model {
/// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format
final String currency;
Locale({
required this.ip,
Locale({ required this.ip,
required this.countryCode,
required this.country,
required this.continentCode,
@@ -39,7 +38,6 @@ class Locale implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"ip": ip,
+4 -6
View File
@@ -14,8 +14,8 @@ class Log implements Model {
final String mode;
/// IP session in use when the session was created.
final String ip;
/// Log creation time in Unix timestamp.
final int time;
/// Log creation date in ISO 8601 format.
final String time;
/// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json).
final String osCode;
/// Operating system name.
@@ -45,8 +45,7 @@ class Log implements Model {
/// Country name.
final String countryName;
Log({
required this.event,
Log({ required this.event,
required this.userId,
required this.userEmail,
required this.userName,
@@ -77,7 +76,7 @@ class Log implements Model {
userName: map['userName'].toString(),
mode: map['mode'].toString(),
ip: map['ip'].toString(),
time: map['time'],
time: map['time'].toString(),
osCode: map['osCode'].toString(),
osName: map['osName'].toString(),
osVersion: map['osVersion'].toString(),
@@ -95,7 +94,6 @@ class Log implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"event": event,
+1 -3
View File
@@ -7,8 +7,7 @@ class LogList implements Model {
/// List of logs.
final List<Log> logs;
LogList({
required this.total,
LogList({ required this.total,
required this.logs,
});
@@ -19,7 +18,6 @@ class LogList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+13 -15
View File
@@ -4,10 +4,10 @@ part of appwrite.models;
class Membership implements Model {
/// Membership ID.
final String $id;
/// Membership creation date in Unix timestamp.
final int $createdAt;
/// Membership update date in Unix timestamp.
final int $updatedAt;
/// Membership creation date in ISO 8601 format.
final String $createdAt;
/// Membership update date in ISO 8601 format.
final String $updatedAt;
/// User ID.
final String userId;
/// User name.
@@ -18,17 +18,16 @@ class Membership implements Model {
final String teamId;
/// Team name.
final String teamName;
/// Date, the user has been invited to join the team in Unix timestamp.
final int invited;
/// Date, the user has accepted the invitation to join the team in Unix timestamp.
final int joined;
/// Date, the user has been invited to join the team in ISO 8601 format.
final String invited;
/// Date, the user has accepted the invitation to join the team in ISO 8601 format.
final String joined;
/// User confirmation status, true if the user has joined the team or false otherwise.
final bool confirm;
/// User list of roles
final List roles;
Membership({
required this.$id,
Membership({ required this.$id,
required this.$createdAt,
required this.$updatedAt,
required this.userId,
@@ -45,21 +44,20 @@ class Membership implements Model {
factory Membership.fromMap(Map<String, dynamic> map) {
return Membership(
$id: map['\$id'].toString(),
$createdAt: map['\$createdAt'],
$updatedAt: map['\$updatedAt'],
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
userId: map['userId'].toString(),
userName: map['userName'].toString(),
userEmail: map['userEmail'].toString(),
teamId: map['teamId'].toString(),
teamName: map['teamName'].toString(),
invited: map['invited'],
joined: map['joined'],
invited: map['invited'].toString(),
joined: map['joined'].toString(),
confirm: map['confirm'],
roles: map['roles'],
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
+1 -3
View File
@@ -7,8 +7,7 @@ class MembershipList implements Model {
/// List of memberships.
final List<Membership> memberships;
MembershipList({
required this.total,
MembershipList({ required this.total,
required this.memberships,
});
@@ -19,7 +18,6 @@ class MembershipList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+1 -3
View File
@@ -9,8 +9,7 @@ class Phone implements Model {
/// Country name.
final String countryName;
Phone({
required this.code,
Phone({ required this.code,
required this.countryCode,
required this.countryName,
});
@@ -23,7 +22,6 @@ class Phone implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"code": code,
+1 -3
View File
@@ -7,8 +7,7 @@ class PhoneList implements Model {
/// List of phones.
final List<Phone> phones;
PhoneList({
required this.total,
PhoneList({ required this.total,
required this.phones,
});
@@ -19,7 +18,6 @@ class PhoneList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+1 -3
View File
@@ -4,8 +4,7 @@ part of appwrite.models;
class Preferences implements Model {
final Map<String, dynamic> data;
Preferences({
required this.data,
Preferences({ required this.data,
});
factory Preferences.fromMap(Map<String, dynamic> map) {
@@ -14,7 +13,6 @@ class Preferences implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"data": data,
+10 -12
View File
@@ -4,20 +4,20 @@ part of appwrite.models;
class Session implements Model {
/// Session ID.
final String $id;
/// Session creation date in Unix timestamp.
final int $createdAt;
/// Session creation date in ISO 8601 format.
final String $createdAt;
/// User ID.
final String userId;
/// Session expiration date in Unix timestamp.
final int expire;
/// Session expiration date in ISO 8601 format.
final String expire;
/// Session Provider.
final String provider;
/// Session Provider User ID.
final String providerUid;
/// Session Provider Access Token.
final String providerAccessToken;
/// Date, the Unix timestamp of when the access token expires.
final int providerAccessTokenExpiry;
/// The date of when the access token expires in ISO 8601 format.
final String providerAccessTokenExpiry;
/// Session Provider Refresh Token.
final String providerRefreshToken;
/// IP in use when the session was created.
@@ -53,8 +53,7 @@ class Session implements Model {
/// Returns true if this the current user session.
final bool current;
Session({
required this.$id,
Session({ required this.$id,
required this.$createdAt,
required this.userId,
required this.expire,
@@ -84,13 +83,13 @@ class Session implements Model {
factory Session.fromMap(Map<String, dynamic> map) {
return Session(
$id: map['\$id'].toString(),
$createdAt: map['\$createdAt'],
$createdAt: map['\$createdAt'].toString(),
userId: map['userId'].toString(),
expire: map['expire'],
expire: map['expire'].toString(),
provider: map['provider'].toString(),
providerUid: map['providerUid'].toString(),
providerAccessToken: map['providerAccessToken'].toString(),
providerAccessTokenExpiry: map['providerAccessTokenExpiry'],
providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(),
providerRefreshToken: map['providerRefreshToken'].toString(),
ip: map['ip'].toString(),
osCode: map['osCode'].toString(),
@@ -111,7 +110,6 @@ class Session implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
+1 -3
View File
@@ -7,8 +7,7 @@ class SessionList implements Model {
/// List of sessions.
final List<Session> sessions;
SessionList({
required this.total,
SessionList({ required this.total,
required this.sessions,
});
@@ -19,7 +18,6 @@ class SessionList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+7 -9
View File
@@ -4,17 +4,16 @@ part of appwrite.models;
class Team implements Model {
/// Team ID.
final String $id;
/// Team creation date in Unix timestamp.
final int $createdAt;
/// Team update date in Unix timestamp.
final int $updatedAt;
/// Team creation date in ISO 8601 format.
final String $createdAt;
/// Team update date in ISO 8601 format.
final String $updatedAt;
/// Team name.
final String name;
/// Total number of team members.
final int total;
Team({
required this.$id,
Team({ required this.$id,
required this.$createdAt,
required this.$updatedAt,
required this.name,
@@ -24,14 +23,13 @@ class Team implements Model {
factory Team.fromMap(Map<String, dynamic> map) {
return Team(
$id: map['\$id'].toString(),
$createdAt: map['\$createdAt'],
$updatedAt: map['\$updatedAt'],
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
name: map['name'].toString(),
total: map['total'],
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
+1 -3
View File
@@ -7,8 +7,7 @@ class TeamList implements Model {
/// List of teams.
final List<Team> teams;
TeamList({
required this.total,
TeamList({ required this.total,
required this.teams,
});
@@ -19,7 +18,6 @@ class TeamList implements Model {
);
}
@override
Map<String, dynamic> toMap() {
return {
"total": total,
+7 -9
View File
@@ -4,17 +4,16 @@ part of appwrite.models;
class Token implements Model {
/// Token ID.
final String $id;
/// Token creation date in Unix timestamp.
final int $createdAt;
/// Token creation date in ISO 8601 format.
final String $createdAt;
/// User ID.
final String userId;
/// Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
final String secret;
/// Token expiration date in Unix timestamp.
final int expire;
/// Token expiration date in ISO 8601 format.
final String expire;
Token({
required this.$id,
Token({ required this.$id,
required this.$createdAt,
required this.userId,
required this.secret,
@@ -24,14 +23,13 @@ class Token implements Model {
factory Token.fromMap(Map<String, dynamic> map) {
return Token(
$id: map['\$id'].toString(),
$createdAt: map['\$createdAt'],
$createdAt: map['\$createdAt'].toString(),
userId: map['userId'].toString(),
secret: map['secret'].toString(),
expire: map['expire'],
expire: map['expire'].toString(),
);
}
@override
Map<String, dynamic> toMap() {
return {
"\$id": $id,
+1 -1
View File
@@ -1,5 +1,5 @@
name: appwrite
version: 7.0.0
version: 8.0.0-dev.1
description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
homepage: https://appwrite.io
repository: https://github.com/appwrite/sdk-for-flutter