Skip to content

Commit bc6bb86

Browse files
committed
Merge branch 'feat-preps-for-0.13' of github.com:appwrite/sdk-generator into feat-preps-0.13-install-sh
2 parents d867757 + 3af54e7 commit bc6bb86

File tree

31 files changed

+120
-45
lines changed

31 files changed

+120
-45
lines changed

specs/swagger2-latest-console.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/SDK/Language/Android.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ public function getFiles()
158158
'template' => '/android/library/src/main/java/io/appwrite/models/RealtimeModels.kt.twig',
159159
'minify' => false,
160160
],
161+
[
162+
'scope' => 'default',
163+
'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/models/UploadProgress.kt',
164+
'template' => '/android/library/src/main/java/io/appwrite/models/UploadProgress.kt.twig',
165+
'minify' => false,
166+
],
161167
[
162168
'scope' => 'default',
163169
'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/WebAuthComponent.kt',

src/SDK/Language/Kotlin.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,12 @@ public function getFiles()
390390
'template' => '/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig',
391391
'minify' => false,
392392
],
393+
[
394+
'scope' => 'default',
395+
'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/models/UploadProgress.kt',
396+
'template' => '/kotlin/src/main/kotlin/io/appwrite/models/UploadProgress.kt.twig',
397+
'minify' => false,
398+
],
393399
[
394400
'scope' => 'definition',
395401
'destination' => '/src/main/kotlin/{{ sdk.namespace | caseSlash }}/models/{{ definition.name | caseUcfirst }}.kt',

src/SDK/Language/Swift.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ public function getFiles()
163163
'template' => 'swift/Sources/Models/Query.swift.twig',
164164
'minify' => false,
165165
],
166+
[
167+
'scope' => 'default',
168+
'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Models/UploadProgress.swift',
169+
'template' => 'swift/Sources/Models/UploadProgress.swift.twig',
170+
'minify' => false,
171+
],
166172
[
167173
'scope' => 'default',
168174
'destination' => '/Sources/{{ spec.title | caseUcfirst}}/Extensions/Codable+JSON.swift',

templates/android/.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
2929
# Builds the release artifacts of the library
3030
- name: Build Release Artifacts
31-
run: ./gradlew --info library:assembleRelease
31+
run: ./gradlew library:assembleRelease
3232

3333
# Generates other artifacts (javadocJar is optional)
3434
- name: Generate Source jar
@@ -39,10 +39,10 @@ jobs:
3939
run: |
4040
if ${{ endswith(github.event.release.tag_name, '-SNAPSHOT') }}; then
4141
echo "Publising Snapshot Version ${{ github.event.release.tag_name}} to Snapshot repository"
42-
./gradlew publishReleasePublicationToSonatypeRepository
42+
./gradlew publishToSonatype
4343
else
4444
echo "Publising Release Version ${{ github.event.release.tag_name}} to Staging repository"
45-
./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
45+
./gradlew publishToSonatype --max-workers 1 closeAndReleaseSonatypeStagingRepository
4646
fi
4747
env:
4848
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}

templates/android/build.gradle.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'io.github.gradle-nexus.publish-plugin'
33
// Top-level build file where you can add configuration options common to all sub-projects/modules.
44
buildscript {
55
ext.kotlin_version = "1.5.31"
6-
version "{{ sdk.version }}"
6+
version System.getenv("SDK_VERSION")
77
repositories {
88
maven { url "https://plugins.gradle.org/m2/" }
99
google()

templates/android/library/build.gradle.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ ext {
1919
GITHUB_SCM_CONNECTION = 'scm:git:git://github.com/{{ sdk.gitUserName }}/{{ sdk.gitRepoName }}.git'
2020
}
2121

22+
version PUBLISH_VERSION
23+
2224
android {
2325
compileSdkVersion(31)
2426

templates/android/library/src/main/java/io/appwrite/Client.kt.twig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {{ sdk.namespace | caseDot }}.{{ spec.title | caseLower }}.BuildConfig
88
import {{ sdk.namespace | caseDot }}.exceptions.{{ spec.title | caseUcfirst }}Exception
99
import {{ sdk.namespace | caseDot }}.extensions.fromJson
1010
import {{ sdk.namespace | caseDot }}.json.PreciseNumberAdapter
11+
import {{ sdk.namespace | caseDot }}.models.UploadProgress
1112
import kotlinx.coroutines.CoroutineScope
1213
import kotlinx.coroutines.Dispatchers
1314
import kotlinx.coroutines.Job
@@ -317,7 +318,7 @@ class Client @JvmOverloads constructor(
317318
responseType: Class<T>,
318319
convert: ((Map<String, Any,>) -> T),
319320
paramName: String,
320-
onProgress: ((Double) -> Unit)? = null,
321+
onProgress: ((UploadProgress) -> Unit)? = null,
321322
): T {
322323
val file = params[paramName] as File
323324
val size = file.length()
@@ -371,7 +372,13 @@ class Client @JvmOverloads constructor(
371372

372373
offset += CHUNK_SIZE
373374
headers["x-{{ spec.title | caseLower }}-id"] = result!!["\$id"].toString()
374-
onProgress?.invoke(offset.coerceAtMost(size).toDouble()/size * 100)
375+
onProgress?.invoke(UploadProgress(
376+
id = result!!["\$id"].toString(),
377+
progress = offset.coerceAtMost(size).toDouble()/size * 100,
378+
sizeUploaded = offset.coerceAtMost(size),
379+
chunksTotal = result!!["chunksTotal"].toString().toInt(),
380+
chunksUploaded = result!!["chunksUploaded"].toString().toInt(),
381+
))
375382
}
376383

377384
return convert(result as Map<String, Any>)

templates/android/library/src/main/java/io/appwrite/models/Error.kt.twig

Lines changed: 0 additions & 6 deletions
This file was deleted.

templates/android/library/src/main/java/io/appwrite/models/Model.kt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{{property.type | typeName}}{% endif %}{% endmacro %}
1+
{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{% if property.type == 'object' and property.additionalProperties %}Map<String, Any>{% else %}{{property.type | typeName}}{% endif %}{% endif %}{% endmacro %}
22
package {{ sdk.namespace | caseDot }}.models
33

44
import com.google.gson.annotations.SerializedName

0 commit comments

Comments
 (0)