Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: android #64

Merged
merged 11 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/autoclose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Auto-close External Pull Requests

on:
pull_request_target:
types: [opened, reopened]

jobs:
auto_close:
uses: appwrite/.github/.github/workflows/autoclose.yml@main
secrets:
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:

```groovy
implementation("io.appwrite:sdk-for-android:6.0.0")
implementation("io.appwrite:sdk-for-android:6.1.0")
```

### Maven
Expand All @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
<dependency>
<groupId>io.appwrite</groupId>
<artifactId>sdk-for-android</artifactId>
<version>6.0.0</version>
<version>6.1.0</version>
</dependency>
</dependencies>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class AccountsViewModel : ViewModel() {
account.createOAuth2Session(
activity,
OAuthProvider.FACEBOOK,
"appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/success",
"appwrite-callback-6070749e6acd4://demo.appwrite.io/auth/oauth2/failure"
"appwrite-callback-6070749e6acd4://cloud.appwrite.io/auth/oauth2/success",
"appwrite-callback-6070749e6acd4://cloud.appwrite.io/auth/oauth2/failure"
)
} catch (e: Exception) {
_error.postValue(Event(e))
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/java/io/appwrite/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Android",
"x-sdk-platform" to "client",
"x-sdk-language" to "android",
"x-sdk-version" to "6.0.0",
"x-sdk-version" to "6.1.0",
"x-appwrite-response-format" to "1.6.0"
)
config = mutableMapOf()
Expand Down
4 changes: 3 additions & 1 deletion library/src/main/java/io/appwrite/enums/ImageFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ enum class ImageFormat(val value: String) {
@SerializedName("png")
PNG("png"),
@SerializedName("webp")
WEBP("webp");
WEBP("webp"),
@SerializedName("avif")
AVIF("avif");

override fun toString() = value
}
6 changes: 3 additions & 3 deletions library/src/main/java/io/appwrite/models/Document.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ data class Document<T>(
* Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
@SerializedName("\$permissions")
val permissions: List<Any>,
val permissions: List<String>,

/**
* Additional properties
Expand All @@ -66,7 +66,7 @@ data class Document<T>(
databaseId: String,
createdAt: String,
updatedAt: String,
permissions: List<Any>,
permissions: List<String>,
data: Map<String, Any>
) = Document<Map<String, Any>>(
id,
Expand All @@ -88,7 +88,7 @@ data class Document<T>(
databaseId = map["\$databaseId"] as String,
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
permissions = map["\$permissions"] as List<Any>,
permissions = map["\$permissions"] as List<String>,
data = map.jsonCast(to = nestedType)
)
}
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/io/appwrite/models/Execution.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data class Execution(
* Execution roles.
*/
@SerializedName("\$permissions")
val permissions: List<Any>,
val permissions: List<String>,

/**
* Function ID.
Expand Down Expand Up @@ -139,7 +139,7 @@ data class Execution(
id = map["\$id"] as String,
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
permissions = map["\$permissions"] as List<Any>,
permissions = map["\$permissions"] as List<String>,
functionId = map["functionId"] as String,
trigger = map["trigger"] as String,
status = map["status"] as String,
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/io/appwrite/models/File.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ data class File(
* File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
*/
@SerializedName("\$permissions")
val permissions: List<Any>,
val permissions: List<String>,

/**
* File name.
Expand Down Expand Up @@ -98,7 +98,7 @@ data class File(
bucketId = map["bucketId"] as String,
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
permissions = map["\$permissions"] as List<Any>,
permissions = map["\$permissions"] as List<String>,
name = map["name"] as String,
signature = map["signature"] as String,
mimeType = map["mimeType"] as String,
Expand Down
10 changes: 5 additions & 5 deletions library/src/main/java/io/appwrite/models/Membership.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ data class Membership(
val userId: String,

/**
* User name.
* User name. Hide this attribute by toggling membership privacy in the Console.
*/
@SerializedName("userName")
val userName: String,

/**
* User email address.
* User email address. Hide this attribute by toggling membership privacy in the Console.
*/
@SerializedName("userEmail")
val userEmail: String,
Expand Down Expand Up @@ -74,7 +74,7 @@ data class Membership(
val confirm: Boolean,

/**
* Multi factor authentication status, true if the user has MFA enabled or false otherwise.
* Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console.
*/
@SerializedName("mfa")
val mfa: Boolean,
Expand All @@ -83,7 +83,7 @@ data class Membership(
* User list of roles
*/
@SerializedName("roles")
val roles: List<Any>,
val roles: List<String>,

) {
fun toMap(): Map<String, Any> = mapOf(
Expand Down Expand Up @@ -120,7 +120,7 @@ data class Membership(
joined = map["joined"] as String,
confirm = map["confirm"] as Boolean,
mfa = map["mfa"] as Boolean,
roles = map["roles"] as List<Any>,
roles = map["roles"] as List<String>,
)
}
}
4 changes: 2 additions & 2 deletions library/src/main/java/io/appwrite/models/MfaRecoveryCodes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data class MfaRecoveryCodes(
* Recovery codes.
*/
@SerializedName("recoveryCodes")
val recoveryCodes: List<Any>,
val recoveryCodes: List<String>,

) {
fun toMap(): Map<String, Any> = mapOf(
Expand All @@ -24,7 +24,7 @@ data class MfaRecoveryCodes(
fun from(
map: Map<String, Any>,
) = MfaRecoveryCodes(
recoveryCodes = map["recoveryCodes"] as List<Any>,
recoveryCodes = map["recoveryCodes"] as List<String>,
)
}
}
4 changes: 2 additions & 2 deletions library/src/main/java/io/appwrite/models/Session.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ data class Session(
* Returns a list of active session factors.
*/
@SerializedName("factors")
val factors: List<Any>,
val factors: List<String>,

/**
* Secret used to authenticate the user. Only included if the request was made with an API key
Expand Down Expand Up @@ -246,7 +246,7 @@ data class Session(
countryCode = map["countryCode"] as String,
countryName = map["countryName"] as String,
current = map["current"] as Boolean,
factors = map["factors"] as List<Any>,
factors = map["factors"] as List<String>,
secret = map["secret"] as String,
mfaUpdatedAt = map["mfaUpdatedAt"] as String,
)
Expand Down
8 changes: 8 additions & 0 deletions library/src/main/java/io/appwrite/models/Target.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ data class Target(
@SerializedName("identifier")
val identifier: String,

/**
* Is the target expired.
*/
@SerializedName("expired")
val expired: Boolean,

) {
fun toMap(): Map<String, Any> = mapOf(
"\$id" to id as Any,
Expand All @@ -65,6 +71,7 @@ data class Target(
"providerId" to providerId as Any,
"providerType" to providerType as Any,
"identifier" to identifier as Any,
"expired" to expired as Any,
)

companion object {
Expand All @@ -81,6 +88,7 @@ data class Target(
providerId = map["providerId"] as? String?,
providerType = map["providerType"] as String,
identifier = map["identifier"] as String,
expired = map["expired"] as Boolean,
)
}
}
6 changes: 3 additions & 3 deletions library/src/main/java/io/appwrite/models/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ data class User<T>(
* Labels for the user.
*/
@SerializedName("labels")
val labels: List<Any>,
val labels: List<String>,

/**
* Password update time in ISO 8601 format.
Expand Down Expand Up @@ -155,7 +155,7 @@ data class User<T>(
hashOptions: Any?,
registration: String,
status: Boolean,
labels: List<Any>,
labels: List<String>,
passwordUpdate: String,
email: String,
phone: String,
Expand Down Expand Up @@ -201,7 +201,7 @@ data class User<T>(
hashOptions = map["hashOptions"] as? Any?,
registration = map["registration"] as String,
status = map["status"] as Boolean,
labels = map["labels"] as List<Any>,
labels = map["labels"] as List<String>,
passwordUpdate = map["passwordUpdate"] as String,
email = map["email"] as String,
phone = map["phone"] as String,
Expand Down
30 changes: 17 additions & 13 deletions library/src/main/java/io/appwrite/services/Account.kt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class Account(client: Client) : Service(client) {
)

/**
* List Identities
* List identities
*
* Get the list of identities for the currently logged in user.
*
Expand Down Expand Up @@ -370,7 +370,7 @@ class Account(client: Client) : Service(client) {
)

/**
* Create Authenticator
* Create authenticator
*
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
*
Expand Down Expand Up @@ -404,7 +404,7 @@ class Account(client: Client) : Service(client) {


/**
* Verify Authenticator
* Verify authenticator
*
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
*
Expand Down Expand Up @@ -441,7 +441,7 @@ class Account(client: Client) : Service(client) {
}

/**
* Verify Authenticator
* Verify authenticator
*
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
*
Expand All @@ -460,7 +460,7 @@ class Account(client: Client) : Service(client) {
)

/**
* Delete Authenticator
* Delete authenticator
*
* Delete an authenticator for a user by ID.
*
Expand Down Expand Up @@ -489,7 +489,7 @@ class Account(client: Client) : Service(client) {


/**
* Create MFA Challenge
* Create MFA challenge
*
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
*
Expand Down Expand Up @@ -523,7 +523,7 @@ class Account(client: Client) : Service(client) {


/**
* Create MFA Challenge (confirmation)
* Create MFA challenge (confirmation)
*
* Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
*
Expand Down Expand Up @@ -555,7 +555,7 @@ class Account(client: Client) : Service(client) {


/**
* List Factors
* List factors
*
* List the factors available on the account to be used as a MFA challange.
*
Expand Down Expand Up @@ -586,7 +586,7 @@ class Account(client: Client) : Service(client) {


/**
* Get MFA Recovery Codes
* Get MFA recovery codes
*
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
*
Expand Down Expand Up @@ -617,7 +617,7 @@ class Account(client: Client) : Service(client) {


/**
* Create MFA Recovery Codes
* Create MFA recovery codes
*
* Generate recovery codes as backup for MFA flow. It&#039;s recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
*
Expand Down Expand Up @@ -648,7 +648,7 @@ class Account(client: Client) : Service(client) {


/**
* Regenerate MFA Recovery Codes
* Regenerate MFA recovery codes
*
* Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
*
Expand Down Expand Up @@ -1209,7 +1209,9 @@ class Account(client: Client) : Service(client) {
return@forEach
}
is List<*> -> {
apiQuery.add("${it.key}[]=${it.value.toString()}")
(it.value as List<*>).forEach { v ->
apiQuery.add("${it.key}[]=${v.toString()}")
}
}
else -> {
apiQuery.add("${it.key}=${it.value.toString()}")
Expand Down Expand Up @@ -1688,7 +1690,9 @@ class Account(client: Client) : Service(client) {
return@forEach
}
is List<*> -> {
apiQuery.add("${it.key}[]=${it.value.toString()}")
(it.value as List<*>).forEach { v ->
apiQuery.add("${it.key}[]=${v.toString()}")
}
}
else -> {
apiQuery.add("${it.key}=${it.value.toString()}")
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/java/io/appwrite/services/Locale.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Locale(client: Client) : Service(client) {


/**
* List Locale Codes
* List locale codes
*
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
*
Expand Down
Loading