Skip to content

Commit 9600602

Browse files
authoredSep 10, 2024
Merge pull request #42 from appwrite/dev
Update attributes
2 parents 80cfc9b + 513f468 commit 9600602

23 files changed

+78
-14
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repositories {
3939
Next, add the dependency to your project's `build.gradle(.kts)` file:
4040

4141
```groovy
42-
implementation("io.appwrite:sdk-for-kotlin:6.0.0")
42+
implementation("io.appwrite:sdk-for-kotlin:6.1.0")
4343
```
4444

4545
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
5050
<dependency>
5151
<groupId>io.appwrite</groupId>
5252
<artifactId>sdk-for-kotlin</artifactId>
53-
<version>6.0.0</version>
53+
<version>6.1.0</version>
5454
</dependency>
5555
</dependencies>
5656
```

‎docs/examples/java/databases/update-boolean-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ databases.updateBooleanAttribute(
1515
"", // key
1616
false, // required
1717
false, // default
18+
"", // newKey (optional)
1819
new CoroutineCallback<>((result, error) -> {
1920
if (error != null) {
2021
error.printStackTrace();

‎docs/examples/java/databases/update-datetime-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ databases.updateDatetimeAttribute(
1515
"", // key
1616
false, // required
1717
"", // default
18+
"", // newKey (optional)
1819
new CoroutineCallback<>((result, error) -> {
1920
if (error != null) {
2021
error.printStackTrace();

‎docs/examples/java/databases/update-email-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ databases.updateEmailAttribute(
1515
"", // key
1616
false, // required
1717
"email@example.com", // default
18+
"", // newKey (optional)
1819
new CoroutineCallback<>((result, error) -> {
1920
if (error != null) {
2021
error.printStackTrace();

‎docs/examples/java/databases/update-enum-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ databases.updateEnumAttribute(
1616
listOf(), // elements
1717
false, // required
1818
"<DEFAULT>", // default
19+
"", // newKey (optional)
1920
new CoroutineCallback<>((result, error) -> {
2021
if (error != null) {
2122
error.printStackTrace();

‎docs/examples/java/databases/update-float-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ databases.updateFloatAttribute(
1717
0, // min
1818
0, // max
1919
0, // default
20+
"", // newKey (optional)
2021
new CoroutineCallback<>((result, error) -> {
2122
if (error != null) {
2223
error.printStackTrace();

‎docs/examples/java/databases/update-integer-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ databases.updateIntegerAttribute(
1717
0, // min
1818
0, // max
1919
0, // default
20+
"", // newKey (optional)
2021
new CoroutineCallback<>((result, error) -> {
2122
if (error != null) {
2223
error.printStackTrace();

‎docs/examples/java/databases/update-ip-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ databases.updateIpAttribute(
1515
"", // key
1616
false, // required
1717
"", // default
18+
"", // newKey (optional)
1819
new CoroutineCallback<>((result, error) -> {
1920
if (error != null) {
2021
error.printStackTrace();

‎docs/examples/java/databases/update-relationship-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ databases.updateRelationshipAttribute(
1414
"<COLLECTION_ID>", // collectionId
1515
"", // key
1616
RelationMutate.CASCADE, // onDelete (optional)
17+
"", // newKey (optional)
1718
new CoroutineCallback<>((result, error) -> {
1819
if (error != null) {
1920
error.printStackTrace();

‎docs/examples/java/databases/update-string-attribute.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ databases.updateStringAttribute(
1515
"", // key
1616
false, // required
1717
"<DEFAULT>", // default
18+
0, // size (optional)
19+
"", // newKey (optional)
1820
new CoroutineCallback<>((result, error) -> {
1921
if (error != null) {
2022
error.printStackTrace();

‎docs/examples/java/databases/update-url-attribute.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ databases.updateUrlAttribute(
1515
"", // key
1616
false, // required
1717
"https://example.com", // default
18+
"", // newKey (optional)
1819
new CoroutineCallback<>((result, error) -> {
1920
if (error != null) {
2021
error.printStackTrace();

‎docs/examples/kotlin/databases/update-boolean-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ val response = databases.updateBooleanAttribute(
1414
collectionId = "<COLLECTION_ID>",
1515
key = "",
1616
required = false,
17-
default = false
17+
default = false,
18+
newKey = "" // optional
1819
)

‎docs/examples/kotlin/databases/update-datetime-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ val response = databases.updateDatetimeAttribute(
1414
collectionId = "<COLLECTION_ID>",
1515
key = "",
1616
required = false,
17-
default = ""
17+
default = "",
18+
newKey = "" // optional
1819
)

‎docs/examples/kotlin/databases/update-email-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ val response = databases.updateEmailAttribute(
1414
collectionId = "<COLLECTION_ID>",
1515
key = "",
1616
required = false,
17-
default = "email@example.com"
17+
default = "email@example.com",
18+
newKey = "" // optional
1819
)

‎docs/examples/kotlin/databases/update-enum-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ val response = databases.updateEnumAttribute(
1515
key = "",
1616
elements = listOf(),
1717
required = false,
18-
default = "<DEFAULT>"
18+
default = "<DEFAULT>",
19+
newKey = "" // optional
1920
)

‎docs/examples/kotlin/databases/update-float-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ val response = databases.updateFloatAttribute(
1616
required = false,
1717
min = 0,
1818
max = 0,
19-
default = 0
19+
default = 0,
20+
newKey = "" // optional
2021
)

‎docs/examples/kotlin/databases/update-integer-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ val response = databases.updateIntegerAttribute(
1616
required = false,
1717
min = 0,
1818
max = 0,
19-
default = 0
19+
default = 0,
20+
newKey = "" // optional
2021
)

‎docs/examples/kotlin/databases/update-ip-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ val response = databases.updateIpAttribute(
1414
collectionId = "<COLLECTION_ID>",
1515
key = "",
1616
required = false,
17-
default = ""
17+
default = "",
18+
newKey = "" // optional
1819
)

‎docs/examples/kotlin/databases/update-relationship-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ val response = databases.updateRelationshipAttribute(
1313
databaseId = "<DATABASE_ID>",
1414
collectionId = "<COLLECTION_ID>",
1515
key = "",
16-
onDelete = "cascade" // optional
16+
onDelete = "cascade", // optional
17+
newKey = "" // optional
1718
)

‎docs/examples/kotlin/databases/update-string-attribute.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ val response = databases.updateStringAttribute(
1414
collectionId = "<COLLECTION_ID>",
1515
key = "",
1616
required = false,
17-
default = "<DEFAULT>"
17+
default = "<DEFAULT>",
18+
size = 0, // optional
19+
newKey = "" // optional
1820
)

‎docs/examples/kotlin/databases/update-url-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ val response = databases.updateUrlAttribute(
1414
collectionId = "<COLLECTION_ID>",
1515
key = "",
1616
required = false,
17-
default = "https://example.com"
17+
default = "https://example.com",
18+
newKey = "" // optional
1819
)

‎src/main/kotlin/io/appwrite/Client.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ class Client @JvmOverloads constructor(
5757
init {
5858
headers = mutableMapOf(
5959
"content-type" to "application/json",
60-
"user-agent" to "AppwriteKotlinSDK/6.0.0 ${System.getProperty("http.agent")}",
60+
"user-agent" to "AppwriteKotlinSDK/6.1.0 ${System.getProperty("http.agent")}",
6161
"x-sdk-name" to "Kotlin",
6262
"x-sdk-platform" to "server",
6363
"x-sdk-language" to "kotlin",
64-
"x-sdk-version" to "6.0.0",
64+
"x-sdk-version" to "6.1.0",
6565
"x-appwrite-response-format" to "1.6.0",
6666
)
6767

‎src/main/kotlin/io/appwrite/services/Databases.kt

+42
Original file line numberDiff line numberDiff line change
@@ -497,15 +497,18 @@ class Databases(client: Client) : Service(client) {
497497
* @param key Attribute Key.
498498
* @param required Is attribute required?
499499
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
500+
* @param newKey New attribute key.
500501
* @return [io.appwrite.models.AttributeBoolean]
501502
*/
503+
@JvmOverloads
502504
@Throws(AppwriteException::class)
503505
suspend fun updateBooleanAttribute(
504506
databaseId: String,
505507
collectionId: String,
506508
key: String,
507509
required: Boolean,
508510
default: Boolean? = null,
511+
newKey: String? = null,
509512
): io.appwrite.models.AttributeBoolean {
510513
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}"
511514
.replace("{databaseId}", databaseId)
@@ -515,6 +518,7 @@ class Databases(client: Client) : Service(client) {
515518
val apiParams = mutableMapOf<String, Any?>(
516519
"required" to required,
517520
"default" to default,
521+
"newKey" to newKey,
518522
)
519523
val apiHeaders = mutableMapOf(
520524
"content-type" to "application/json",
@@ -591,15 +595,18 @@ class Databases(client: Client) : Service(client) {
591595
* @param key Attribute Key.
592596
* @param required Is attribute required?
593597
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
598+
* @param newKey New attribute key.
594599
* @return [io.appwrite.models.AttributeDatetime]
595600
*/
601+
@JvmOverloads
596602
@Throws(AppwriteException::class)
597603
suspend fun updateDatetimeAttribute(
598604
databaseId: String,
599605
collectionId: String,
600606
key: String,
601607
required: Boolean,
602608
default: String? = null,
609+
newKey: String? = null,
603610
): io.appwrite.models.AttributeDatetime {
604611
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}"
605612
.replace("{databaseId}", databaseId)
@@ -609,6 +616,7 @@ class Databases(client: Client) : Service(client) {
609616
val apiParams = mutableMapOf<String, Any?>(
610617
"required" to required,
611618
"default" to default,
619+
"newKey" to newKey,
612620
)
613621
val apiHeaders = mutableMapOf(
614622
"content-type" to "application/json",
@@ -685,15 +693,18 @@ class Databases(client: Client) : Service(client) {
685693
* @param key Attribute Key.
686694
* @param required Is attribute required?
687695
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
696+
* @param newKey New attribute key.
688697
* @return [io.appwrite.models.AttributeEmail]
689698
*/
699+
@JvmOverloads
690700
@Throws(AppwriteException::class)
691701
suspend fun updateEmailAttribute(
692702
databaseId: String,
693703
collectionId: String,
694704
key: String,
695705
required: Boolean,
696706
default: String? = null,
707+
newKey: String? = null,
697708
): io.appwrite.models.AttributeEmail {
698709
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}"
699710
.replace("{databaseId}", databaseId)
@@ -703,6 +714,7 @@ class Databases(client: Client) : Service(client) {
703714
val apiParams = mutableMapOf<String, Any?>(
704715
"required" to required,
705716
"default" to default,
717+
"newKey" to newKey,
706718
)
707719
val apiHeaders = mutableMapOf(
708720
"content-type" to "application/json",
@@ -783,8 +795,10 @@ class Databases(client: Client) : Service(client) {
783795
* @param elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
784796
* @param required Is attribute required?
785797
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
798+
* @param newKey New attribute key.
786799
* @return [io.appwrite.models.AttributeEnum]
787800
*/
801+
@JvmOverloads
788802
@Throws(AppwriteException::class)
789803
suspend fun updateEnumAttribute(
790804
databaseId: String,
@@ -793,6 +807,7 @@ class Databases(client: Client) : Service(client) {
793807
elements: List<String>,
794808
required: Boolean,
795809
default: String? = null,
810+
newKey: String? = null,
796811
): io.appwrite.models.AttributeEnum {
797812
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}"
798813
.replace("{databaseId}", databaseId)
@@ -803,6 +818,7 @@ class Databases(client: Client) : Service(client) {
803818
"elements" to elements,
804819
"required" to required,
805820
"default" to default,
821+
"newKey" to newKey,
806822
)
807823
val apiHeaders = mutableMapOf(
808824
"content-type" to "application/json",
@@ -887,8 +903,10 @@ class Databases(client: Client) : Service(client) {
887903
* @param min Minimum value to enforce on new documents
888904
* @param max Maximum value to enforce on new documents
889905
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
906+
* @param newKey New attribute key.
890907
* @return [io.appwrite.models.AttributeFloat]
891908
*/
909+
@JvmOverloads
892910
@Throws(AppwriteException::class)
893911
suspend fun updateFloatAttribute(
894912
databaseId: String,
@@ -898,6 +916,7 @@ class Databases(client: Client) : Service(client) {
898916
min: Double,
899917
max: Double,
900918
default: Double? = null,
919+
newKey: String? = null,
901920
): io.appwrite.models.AttributeFloat {
902921
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}"
903922
.replace("{databaseId}", databaseId)
@@ -909,6 +928,7 @@ class Databases(client: Client) : Service(client) {
909928
"min" to min,
910929
"max" to max,
911930
"default" to default,
931+
"newKey" to newKey,
912932
)
913933
val apiHeaders = mutableMapOf(
914934
"content-type" to "application/json",
@@ -993,8 +1013,10 @@ class Databases(client: Client) : Service(client) {
9931013
* @param min Minimum value to enforce on new documents
9941014
* @param max Maximum value to enforce on new documents
9951015
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
1016+
* @param newKey New attribute key.
9961017
* @return [io.appwrite.models.AttributeInteger]
9971018
*/
1019+
@JvmOverloads
9981020
@Throws(AppwriteException::class)
9991021
suspend fun updateIntegerAttribute(
10001022
databaseId: String,
@@ -1004,6 +1026,7 @@ class Databases(client: Client) : Service(client) {
10041026
min: Long,
10051027
max: Long,
10061028
default: Long? = null,
1029+
newKey: String? = null,
10071030
): io.appwrite.models.AttributeInteger {
10081031
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}"
10091032
.replace("{databaseId}", databaseId)
@@ -1015,6 +1038,7 @@ class Databases(client: Client) : Service(client) {
10151038
"min" to min,
10161039
"max" to max,
10171040
"default" to default,
1041+
"newKey" to newKey,
10181042
)
10191043
val apiHeaders = mutableMapOf(
10201044
"content-type" to "application/json",
@@ -1091,15 +1115,18 @@ class Databases(client: Client) : Service(client) {
10911115
* @param key Attribute Key.
10921116
* @param required Is attribute required?
10931117
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
1118+
* @param newKey New attribute key.
10941119
* @return [io.appwrite.models.AttributeIp]
10951120
*/
1121+
@JvmOverloads
10961122
@Throws(AppwriteException::class)
10971123
suspend fun updateIpAttribute(
10981124
databaseId: String,
10991125
collectionId: String,
11001126
key: String,
11011127
required: Boolean,
11021128
default: String? = null,
1129+
newKey: String? = null,
11031130
): io.appwrite.models.AttributeIp {
11041131
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}"
11051132
.replace("{databaseId}", databaseId)
@@ -1109,6 +1136,7 @@ class Databases(client: Client) : Service(client) {
11091136
val apiParams = mutableMapOf<String, Any?>(
11101137
"required" to required,
11111138
"default" to default,
1139+
"newKey" to newKey,
11121140
)
11131141
val apiHeaders = mutableMapOf(
11141142
"content-type" to "application/json",
@@ -1246,15 +1274,20 @@ class Databases(client: Client) : Service(client) {
12461274
* @param key Attribute Key.
12471275
* @param required Is attribute required?
12481276
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
1277+
* @param size Maximum size of the string attribute.
1278+
* @param newKey New attribute key.
12491279
* @return [io.appwrite.models.AttributeString]
12501280
*/
1281+
@JvmOverloads
12511282
@Throws(AppwriteException::class)
12521283
suspend fun updateStringAttribute(
12531284
databaseId: String,
12541285
collectionId: String,
12551286
key: String,
12561287
required: Boolean,
12571288
default: String? = null,
1289+
size: Long? = null,
1290+
newKey: String? = null,
12581291
): io.appwrite.models.AttributeString {
12591292
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}"
12601293
.replace("{databaseId}", databaseId)
@@ -1264,6 +1297,8 @@ class Databases(client: Client) : Service(client) {
12641297
val apiParams = mutableMapOf<String, Any?>(
12651298
"required" to required,
12661299
"default" to default,
1300+
"size" to size,
1301+
"newKey" to newKey,
12671302
)
12681303
val apiHeaders = mutableMapOf(
12691304
"content-type" to "application/json",
@@ -1340,15 +1375,18 @@ class Databases(client: Client) : Service(client) {
13401375
* @param key Attribute Key.
13411376
* @param required Is attribute required?
13421377
* @param default Default value for attribute when not provided. Cannot be set when attribute is required.
1378+
* @param newKey New attribute key.
13431379
* @return [io.appwrite.models.AttributeUrl]
13441380
*/
1381+
@JvmOverloads
13451382
@Throws(AppwriteException::class)
13461383
suspend fun updateUrlAttribute(
13471384
databaseId: String,
13481385
collectionId: String,
13491386
key: String,
13501387
required: Boolean,
13511388
default: String? = null,
1389+
newKey: String? = null,
13521390
): io.appwrite.models.AttributeUrl {
13531391
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}"
13541392
.replace("{databaseId}", databaseId)
@@ -1358,6 +1396,7 @@ class Databases(client: Client) : Service(client) {
13581396
val apiParams = mutableMapOf<String, Any?>(
13591397
"required" to required,
13601398
"default" to default,
1399+
"newKey" to newKey,
13611400
)
13621401
val apiHeaders = mutableMapOf(
13631402
"content-type" to "application/json",
@@ -1454,6 +1493,7 @@ class Databases(client: Client) : Service(client) {
14541493
* @param collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
14551494
* @param key Attribute Key.
14561495
* @param onDelete Constraints option
1496+
* @param newKey New attribute key.
14571497
* @return [io.appwrite.models.AttributeRelationship]
14581498
*/
14591499
@JvmOverloads
@@ -1463,6 +1503,7 @@ class Databases(client: Client) : Service(client) {
14631503
collectionId: String,
14641504
key: String,
14651505
onDelete: io.appwrite.enums.RelationMutate? = null,
1506+
newKey: String? = null,
14661507
): io.appwrite.models.AttributeRelationship {
14671508
val apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship"
14681509
.replace("{databaseId}", databaseId)
@@ -1471,6 +1512,7 @@ class Databases(client: Client) : Service(client) {
14711512

14721513
val apiParams = mutableMapOf<String, Any?>(
14731514
"onDelete" to onDelete,
1515+
"newKey" to newKey,
14741516
)
14751517
val apiHeaders = mutableMapOf(
14761518
"content-type" to "application/json",

0 commit comments

Comments
 (0)
Please sign in to comment.