Skip to content

Commit c72d0d8

Browse files
authored
Merge pull request #115 from appwrite/dev
2 parents 3085659 + e7e784c commit c72d0d8

7 files changed

Lines changed: 89 additions & 15 deletions

File tree

CHANGELOG.md

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

3+
## 14.0.0
4+
5+
* [BREAKING] Changed `$sequence` type from `Long` to `String` for `Row` and `Document` models
6+
* Added impersonation support: `setImpersonateUserId()`, `setImpersonateUserEmail()`, `setImpersonateUserPhone()` on `Client`
7+
* Added `impersonator` and `impersonatorUserId` optional fields to `User` model
8+
* Updated `Log` model field descriptions to clarify impersonation behavior for `userId`, `userEmail`, `userName`
9+
* Updated `X-Appwrite-Response-Format` header to `1.9.0`
10+
* Updated API version badge to `1.9.0` and compatibility note to server version `1.9.x` in README
11+
312
## 13.0.0
413

514
* Breaking: Channel factory methods require explicit IDs (no wildcard defaults)

README.md

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

33
![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-android.svg?color=green&style=flat-square)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-android.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.9.0-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-android/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-android/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 Android 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

@@ -38,7 +38,7 @@ repositories {
3838
Next, add the dependency to your project's `build.gradle(.kts)` file:
3939

4040
```groovy
41-
implementation("io.appwrite:sdk-for-android:13.0.0")
41+
implementation("io.appwrite:sdk-for-android:14.0.0")
4242
```
4343

4444
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
4949
<dependency>
5050
<groupId>io.appwrite</groupId>
5151
<artifactId>sdk-for-android</artifactId>
52-
<version>13.0.0</version>
52+
<version>14.0.0</version>
5353
</dependency>
5454
</dependencies>
5555
```

library/src/main/java/io/appwrite/Client.kt

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class Client @JvmOverloads constructor(
8787
"x-sdk-name" to "Android",
8888
"x-sdk-platform" to "client",
8989
"x-sdk-language" to "android",
90-
"x-sdk-version" to "13.0.0",
91-
"x-appwrite-response-format" to "1.8.0"
90+
"x-sdk-version" to "14.0.0",
91+
"x-appwrite-response-format" to "1.9.0"
9292
)
9393
config = mutableMapOf()
9494

@@ -168,6 +168,51 @@ class Client @JvmOverloads constructor(
168168
return this
169169
}
170170

171+
/**
172+
* Set ImpersonateUserId
173+
*
174+
* 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.
175+
*
176+
* @param {string} impersonateuserid
177+
*
178+
* @return this
179+
*/
180+
fun setImpersonateUserId(value: String): Client {
181+
config["impersonateUserId"] = value
182+
addHeader("x-appwrite-impersonate-user-id", value)
183+
return this
184+
}
185+
186+
/**
187+
* Set ImpersonateUserEmail
188+
*
189+
* 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.
190+
*
191+
* @param {string} impersonateuseremail
192+
*
193+
* @return this
194+
*/
195+
fun setImpersonateUserEmail(value: String): Client {
196+
config["impersonateUserEmail"] = value
197+
addHeader("x-appwrite-impersonate-user-email", value)
198+
return this
199+
}
200+
201+
/**
202+
* Set ImpersonateUserPhone
203+
*
204+
* 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.
205+
*
206+
* @param {string} impersonateuserphone
207+
*
208+
* @return this
209+
*/
210+
fun setImpersonateUserPhone(value: String): Client {
211+
config["impersonateUserPhone"] = value
212+
addHeader("x-appwrite-impersonate-user-phone", value)
213+
return this
214+
}
215+
171216
/**
172217
* Set self Signed
173218
*

library/src/main/java/io/appwrite/models/Document.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data class Document<T>(
1717
* Document sequence ID.
1818
*/
1919
@SerializedName("\$sequence")
20-
val sequence: Long,
20+
val sequence: String,
2121

2222
/**
2323
* Collection ID.
@@ -69,7 +69,7 @@ data class Document<T>(
6969
companion object {
7070
operator fun invoke(
7171
id: String,
72-
sequence: Long,
72+
sequence: String,
7373
collectionId: String,
7474
databaseId: String,
7575
createdAt: String,
@@ -93,7 +93,7 @@ data class Document<T>(
9393
nestedType: Class<T>
9494
) = Document<T>(
9595
id = map["\$id"] as String,
96-
sequence = (map["\$sequence"] as Number).toLong(),
96+
sequence = map["\$sequence"] as String,
9797
collectionId = map["\$collectionId"] as String,
9898
databaseId = map["\$databaseId"] as String,
9999
createdAt = map["\$createdAt"] as String,

library/src/main/java/io/appwrite/models/Log.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ data class Log(
1414
val event: String,
1515

1616
/**
17-
* User ID.
17+
* User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user.
1818
*/
1919
@SerializedName("userId")
2020
val userId: String,
2121

2222
/**
23-
* User Email.
23+
* User email of the actor recorded for this log. During impersonation, this is the original impersonator.
2424
*/
2525
@SerializedName("userEmail")
2626
val userEmail: String,
2727

2828
/**
29-
* User Name.
29+
* User name of the actor recorded for this log. During impersonation, this is the original impersonator.
3030
*/
3131
@SerializedName("userName")
3232
val userName: String,

library/src/main/java/io/appwrite/models/Row.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data class Row<T>(
1717
* Row sequence ID.
1818
*/
1919
@SerializedName("\$sequence")
20-
val sequence: Long,
20+
val sequence: String,
2121

2222
/**
2323
* Table ID.
@@ -69,7 +69,7 @@ data class Row<T>(
6969
companion object {
7070
operator fun invoke(
7171
id: String,
72-
sequence: Long,
72+
sequence: String,
7373
tableId: String,
7474
databaseId: String,
7575
createdAt: String,
@@ -93,7 +93,7 @@ data class Row<T>(
9393
nestedType: Class<T>
9494
) = Row<T>(
9595
id = map["\$id"] as String,
96-
sequence = (map["\$sequence"] as Number).toLong(),
96+
sequence = map["\$sequence"] as String,
9797
tableId = map["\$tableId"] as String,
9898
databaseId = map["\$databaseId"] as String,
9999
createdAt = map["\$createdAt"] as String,

library/src/main/java/io/appwrite/models/User.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ data class User<T>(
121121
@SerializedName("accessedAt")
122122
val accessedAt: String,
123123

124+
/**
125+
* Whether the user can impersonate other users.
126+
*/
127+
@SerializedName("impersonator")
128+
var impersonator: Boolean?,
129+
130+
/**
131+
* ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data.
132+
*/
133+
@SerializedName("impersonatorUserId")
134+
var impersonatorUserId: String?,
135+
124136
) {
125137
fun toMap(): Map<String, Any> = mapOf(
126138
"\$id" to id as Any,
@@ -142,6 +154,8 @@ data class User<T>(
142154
"prefs" to prefs.toMap() as Any,
143155
"targets" to targets.map { it.toMap() } as Any,
144156
"accessedAt" to accessedAt as Any,
157+
"impersonator" to impersonator as Any,
158+
"impersonatorUserId" to impersonatorUserId as Any,
145159
)
146160

147161
companion object {
@@ -165,6 +179,8 @@ data class User<T>(
165179
prefs: Preferences<Map<String, Any>>,
166180
targets: List<Target>,
167181
accessedAt: String,
182+
impersonator: Boolean?,
183+
impersonatorUserId: String?,
168184
) = User<Map<String, Any>>(
169185
id,
170186
createdAt,
@@ -185,6 +201,8 @@ data class User<T>(
185201
prefs,
186202
targets,
187203
accessedAt,
204+
impersonator,
205+
impersonatorUserId,
188206
)
189207

190208
@Suppress("UNCHECKED_CAST")
@@ -211,6 +229,8 @@ data class User<T>(
211229
prefs = Preferences.from(map = map["prefs"] as Map<String, Any>, nestedType),
212230
targets = (map["targets"] as List<Map<String, Any>>).map { Target.from(map = it) },
213231
accessedAt = map["accessedAt"] as String,
232+
impersonator = map["impersonator"] as? Boolean,
233+
impersonatorUserId = map["impersonatorUserId"] as? String,
214234
)
215235
}
216236
}

0 commit comments

Comments
 (0)