Skip to content

Commit 44379c0

Browse files
authored
Merge pull request #304 from appwrite/dev
2 parents 1f2dc8e + 45ac565 commit 44379c0

16 files changed

Lines changed: 125 additions & 32 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 23.0.0
4+
5+
* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents
6+
* Updated README badge to API version `1.9.x` and dependency example
7+
* Updated dependency example to `^21.1.0`
8+
39
## 22.0.0
410

511
* Breaking: Channel API no longer defaults to '*'; explicit IDs required.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
[![pub package](https://img.shields.io/pub/v/appwrite?style=flat-square)](https://pub.dartlang.org/packages/appwrite)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-1.8.x-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.9.x-blue.svg?style=flat-square)
66
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
77
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
99

10-
**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
10+
**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
1111

1212
Appwrite is an open-source backend as a service server that abstracts and simplifies 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)
1313

@@ -19,7 +19,7 @@ Add this to your package's `pubspec.yaml` file:
1919

2020
```yml
2121
dependencies:
22-
appwrite: ^22.0.0
22+
appwrite: ^23.0.0
2323
```
2424
2525
You can install packages from the command line:

lib/appwrite.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Appwrite Flutter SDK
22
///
3-
/// This SDK is compatible with Appwrite server version 1.8.x.
3+
/// This SDK is compatible with Appwrite server version 1.9.x.
44
/// For older versions, please check
55
/// [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).
66
library appwrite;

lib/src/client.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ abstract class Client {
7979
/// Your secret dev API key.
8080
Client setDevKey(String value);
8181

82+
/// Set ImpersonateUserId.
83+
///
84+
/// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data..
85+
Client setImpersonateUserId(String value);
86+
87+
/// Set ImpersonateUserEmail.
88+
///
89+
/// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data..
90+
Client setImpersonateUserEmail(String value);
91+
92+
/// Set ImpersonateUserPhone.
93+
///
94+
/// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data..
95+
Client setImpersonateUserPhone(String value);
96+
8297
/// Add headers that should be sent with all API calls.
8398
Client addHeader(String key, String value);
8499

lib/src/client_base.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ abstract class ClientBase implements Client {
2121
@override
2222
ClientBase setDevKey(value);
2323

24+
/// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
25+
@override
26+
ClientBase setImpersonateUserId(value);
27+
28+
/// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
29+
@override
30+
ClientBase setImpersonateUserEmail(value);
31+
32+
/// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
33+
@override
34+
ClientBase setImpersonateUserPhone(value);
35+
2436
@override
2537
ClientBase setSelfSigned({bool status = true});
2638

lib/src/client_browser.dart

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class ClientBrowser extends ClientBase with ClientMixin {
4040
'x-sdk-name': 'Flutter',
4141
'x-sdk-platform': 'client',
4242
'x-sdk-language': 'flutter',
43-
'x-sdk-version': '22.0.0',
44-
'X-Appwrite-Response-Format': '1.8.0',
43+
'x-sdk-version': '23.0.0',
44+
'X-Appwrite-Response-Format': '1.9.0',
4545
};
4646

4747
config = {};
@@ -95,6 +95,30 @@ class ClientBrowser extends ClientBase with ClientMixin {
9595
return this;
9696
}
9797

98+
/// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
99+
@override
100+
ClientBrowser setImpersonateUserId(value) {
101+
config['impersonateUserId'] = value;
102+
addHeader('X-Appwrite-Impersonate-User-Id', value);
103+
return this;
104+
}
105+
106+
/// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
107+
@override
108+
ClientBrowser setImpersonateUserEmail(value) {
109+
config['impersonateUserEmail'] = value;
110+
addHeader('X-Appwrite-Impersonate-User-Email', value);
111+
return this;
112+
}
113+
114+
/// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
115+
@override
116+
ClientBrowser setImpersonateUserPhone(value) {
117+
config['impersonateUserPhone'] = value;
118+
addHeader('X-Appwrite-Impersonate-User-Phone', value);
119+
return this;
120+
}
121+
98122
@override
99123
ClientBrowser setSelfSigned({bool status = true}) {
100124
return this;

lib/src/client_io.dart

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ClientIO extends ClientBase with ClientMixin {
5858
'x-sdk-name': 'Flutter',
5959
'x-sdk-platform': 'client',
6060
'x-sdk-language': 'flutter',
61-
'x-sdk-version': '22.0.0',
62-
'X-Appwrite-Response-Format': '1.8.0',
61+
'x-sdk-version': '23.0.0',
62+
'X-Appwrite-Response-Format': '1.9.0',
6363
};
6464

6565
config = {};
@@ -121,6 +121,30 @@ class ClientIO extends ClientBase with ClientMixin {
121121
return this;
122122
}
123123

124+
/// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
125+
@override
126+
ClientIO setImpersonateUserId(value) {
127+
config['impersonateUserId'] = value;
128+
addHeader('X-Appwrite-Impersonate-User-Id', value);
129+
return this;
130+
}
131+
132+
/// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
133+
@override
134+
ClientIO setImpersonateUserEmail(value) {
135+
config['impersonateUserEmail'] = value;
136+
addHeader('X-Appwrite-Impersonate-User-Email', value);
137+
return this;
138+
}
139+
140+
/// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
141+
@override
142+
ClientIO setImpersonateUserPhone(value) {
143+
config['impersonateUserPhone'] = value;
144+
addHeader('X-Appwrite-Impersonate-User-Phone', value);
145+
return this;
146+
}
147+
124148
@override
125149
ClientIO setSelfSigned({bool status = true}) {
126150
selfSigned = status;

lib/src/models/document.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Document implements Model {
66
final String $id;
77

88
/// Document sequence ID.
9-
final int $sequence;
9+
final String $sequence;
1010

1111
/// Collection ID.
1212
final String $collectionId;
@@ -39,7 +39,7 @@ class Document implements Model {
3939
factory Document.fromMap(Map<String, dynamic> map) {
4040
return Document(
4141
$id: map['\$id'].toString(),
42-
$sequence: map['\$sequence'],
42+
$sequence: map['\$sequence'].toString(),
4343
$collectionId: map['\$collectionId'].toString(),
4444
$databaseId: map['\$databaseId'].toString(),
4545
$createdAt: map['\$createdAt'].toString(),

lib/src/models/log.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ class Log implements Model {
55
/// Event name.
66
final String event;
77

8-
/// User ID.
8+
/// User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user.
99
final String userId;
1010

11-
/// User Email.
11+
/// User email of the actor recorded for this log. During impersonation, this is the original impersonator.
1212
final String userEmail;
1313

14-
/// User Name.
14+
/// User name of the actor recorded for this log. During impersonation, this is the original impersonator.
1515
final String userName;
1616

1717
/// API mode when event triggered.

lib/src/models/row.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Row implements Model {
66
final String $id;
77

88
/// Row sequence ID.
9-
final int $sequence;
9+
final String $sequence;
1010

1111
/// Table ID.
1212
final String $tableId;
@@ -39,7 +39,7 @@ class Row implements Model {
3939
factory Row.fromMap(Map<String, dynamic> map) {
4040
return Row(
4141
$id: map['\$id'].toString(),
42-
$sequence: map['\$sequence'],
42+
$sequence: map['\$sequence'].toString(),
4343
$tableId: map['\$tableId'].toString(),
4444
$databaseId: map['\$databaseId'].toString(),
4545
$createdAt: map['\$createdAt'].toString(),

0 commit comments

Comments
 (0)