Skip to content

Commit 9ac99f6

Browse files
committed
fix: multipart testing
1 parent 3d4e23c commit 9ac99f6

File tree

7 files changed

+28
-18
lines changed

7 files changed

+28
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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:7.0.0-rc1")
41+
implementation("io.appwrite:sdk-for-android:6.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>7.0.0-rc1</version>
52+
<version>6.0.0</version>
5353
</dependency>
5454
</dependencies>
5555
```

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ 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 "7.0.0-rc1",
90+
"x-sdk-version" to "6.0.0",
9191
"x-appwrite-response-format" to "1.6.0"
9292
)
9393
config = mutableMapOf()
@@ -320,6 +320,14 @@ class Client @JvmOverloads constructor(
320320
)
321321
}
322322
}
323+
it.value is Payload -> {
324+
val payload = it.value as Payload
325+
if (payload.sourceType == "path") {
326+
builder.addFormDataPart(it.key, payload.filename, File(payload.path).asRequestBody())
327+
} else {
328+
builder.addFormDataPart(it.key, payload.toString())
329+
}
330+
}
323331
else -> {
324332
builder.addFormDataPart(it.key, it.value.toString())
325333
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ data class Execution(
7777
* HTTP response body. This will return empty unless execution is created as synchronous.
7878
*/
7979
@SerializedName("responseBody")
80-
val responseBody: String,
80+
val responseBody: Payload,
8181

8282
/**
8383
* HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
@@ -147,7 +147,7 @@ data class Execution(
147147
requestPath = map["requestPath"] as String,
148148
requestHeaders = (map["requestHeaders"] as List<Map<String, Any>>).map { Headers.from(map = it) },
149149
responseStatusCode = (map["responseStatusCode"] as Number).toLong(),
150-
responseBody = map["responseBody"] as String,
150+
responseBody = map["responseBody"] as Payload,
151151
responseHeaders = (map["responseHeaders"] as List<Map<String, Any>>).map { Headers.from(map = it) },
152152
logs = map["logs"] as String,
153153
errors = map["errors"] as String,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Payload private constructor() {
3939
}
4040

4141
fun toFile(path: String): File {
42+
Files.createDirectories(Paths.get(path).parent);
43+
4244
val file = File(path)
4345
file.appendBytes(toBinary())
4446
return file

library/src/main/java/io/appwrite/services/Account.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class Account(client: Client) : Service(client) {
190190
)
191191

192192
/**
193-
* List Identities
193+
* List identities
194194
*
195195
* Get the list of identities for the currently logged in user.
196196
*
@@ -370,7 +370,7 @@ class Account(client: Client) : Service(client) {
370370
)
371371

372372
/**
373-
* Create Authenticator
373+
* Create authenticator
374374
*
375375
* 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.
376376
*
@@ -404,7 +404,7 @@ class Account(client: Client) : Service(client) {
404404

405405

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

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

462462
/**
463-
* Delete Authenticator
463+
* Delete authenticator
464464
*
465465
* Delete an authenticator for a user by ID.
466466
*
@@ -489,7 +489,7 @@ class Account(client: Client) : Service(client) {
489489

490490

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

524524

525525
/**
526-
* Create MFA Challenge (confirmation)
526+
* Create MFA challenge (confirmation)
527527
*
528528
* 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.
529529
*
@@ -555,7 +555,7 @@ class Account(client: Client) : Service(client) {
555555

556556

557557
/**
558-
* List Factors
558+
* List factors
559559
*
560560
* List the factors available on the account to be used as a MFA challange.
561561
*
@@ -586,7 +586,7 @@ class Account(client: Client) : Service(client) {
586586

587587

588588
/**
589-
* Get MFA Recovery Codes
589+
* Get MFA recovery codes
590590
*
591591
* 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.
592592
*
@@ -617,7 +617,7 @@ class Account(client: Client) : Service(client) {
617617

618618

619619
/**
620-
* Create MFA Recovery Codes
620+
* Create MFA recovery codes
621621
*
622622
* 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.
623623
*
@@ -648,7 +648,7 @@ class Account(client: Client) : Service(client) {
648648

649649

650650
/**
651-
* Regenerate MFA Recovery Codes
651+
* Regenerate MFA recovery codes
652652
*
653653
* 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.
654654
*

library/src/main/java/io/appwrite/services/Locale.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Locale(client: Client) : Service(client) {
4747

4848

4949
/**
50-
* List Locale Codes
50+
* List locale codes
5151
*
5252
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
5353
*

library/src/main/java/io/appwrite/services/Storage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class Storage(client: Client) : Service(client) {
189189

190190

191191
/**
192-
* Delete File
192+
* Delete file
193193
*
194194
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
195195
*

0 commit comments

Comments
 (0)