Skip to content

Commit 1ad5b1c

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat-dependency-upgrades-2
2 parents da4e3b0 + 196595b commit 1ad5b1c

File tree

9 files changed

+106
-16
lines changed

9 files changed

+106
-16
lines changed

templates/android/library/build.gradle.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ ext {
2222
version PUBLISH_VERSION
2323

2424
android {
25-
compileSdkVersion(33)
25+
compileSdkVersion(34)
2626

2727
defaultConfig {
2828
minSdkVersion(21)
29-
targetSdkVersion(33)
29+
targetSdkVersion(34)
3030
versionCode = 1
3131
versionName = "1.0"
3232
buildConfigField "String", "SDK_VERSION", "\"${PUBLISH_VERSION}\""
@@ -57,7 +57,7 @@ dependencies {
5757
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
5858
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1")
5959

60-
api(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
60+
api(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
6161
api("com.squareup.okhttp3:okhttp")
6262
implementation("com.squareup.okhttp3:okhttp-urlconnection")
6363
implementation("com.squareup.okhttp3:logging-interceptor")
@@ -77,4 +77,4 @@ dependencies {
7777
testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
7878
}
7979

80-
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
80+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"

templates/dart/lib/src/models/model.dart.twig

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,25 @@ class {{ definition.name | caseUcfirst | overrideIdentifier }} implements Model
2424
factory {{ definition.name | caseUcfirst | overrideIdentifier}}.fromMap(Map<String, dynamic> map) {
2525
return {{ definition.name | caseUcfirst | overrideIdentifier }}(
2626
{% for property in definition.properties %}
27-
{{ property.name | escapeKeyword }}: {% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst | overrideIdentifier}}>.from(map['{{property.name | escapeDollarSign }}'].map((p) => {{property.sub_schema | caseUcfirst | overrideIdentifier}}.fromMap(p))){% else %}{{property.sub_schema | caseUcfirst | overrideIdentifier}}.fromMap(map['{{property.name | escapeDollarSign }}']){% endif %}{% else %}map['{{property.name | escapeDollarSign }}']{% if property.type == "number" %}{% if not property.required %}?{% endif %}.toDouble(){% endif %}{% if property.type == "string" %}{% if not property.required %}?{% endif %}.toString(){% endif %}{% endif %},
27+
{{ property.name | escapeKeyword }}:{{' '}}
28+
{%- if property.sub_schema -%}
29+
{%- if property.type == 'array' -%}
30+
List<{{property.sub_schema | caseUcfirst | overrideIdentifier}}>.from(map['{{property.name | escapeDollarSign }}'].map((p) => {{property.sub_schema | caseUcfirst | overrideIdentifier}}.fromMap(p)))
31+
{%- else -%}
32+
{{property.sub_schema | caseUcfirst | overrideIdentifier}}.fromMap(map['{{property.name | escapeDollarSign }}'])
33+
{%- endif -%}
34+
{%- else -%}
35+
map['{{property.name | escapeDollarSign }}']
36+
{%- if property.type == "number" -%}
37+
{%- if not property.required %}?{% endif %}.toDouble()
38+
{%- endif -%}
39+
{%- if property.type == "string" -%}
40+
{%- if not property.required %}?{% endif %}.toString()
41+
{%- endif -%}
42+
{%- if property.type == "array" -%}
43+
{% if property.required %} ?? []{% endif %}
44+
{%- endif -%}
45+
{%- endif -%},
2846
{% endfor %}
2947
{% if definition.additionalProperties %}
3048
data: map,

templates/dotnet/src/Appwrite/Client.cs.twig

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ namespace {{ spec.title | caseUcfirst }}
221221
.FirstOrDefault() ?? string.Empty;
222222

223223
var isJson = contentType.Contains("application/json");
224-
var isBytes = contentType.Contains("application/octet-stream");
225224

226225
if (code >= 400) {
227226
var message = await response.Content.ReadAsStringAsync();
@@ -248,13 +247,9 @@ namespace {{ spec.title | caseUcfirst }}
248247

249248
return (dict as T)!;
250249
}
251-
else if (isBytes)
252-
{
253-
return ((await response.Content.ReadAsByteArrayAsync()) as T)!;
254-
}
255250
else
256251
{
257-
return default!;
252+
return ((await response.Content.ReadAsByteArrayAsync()) as T)!;
258253
}
259254
}
260255

templates/python/package/input_file.py.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class InputFile:
1212
return instance
1313

1414
@classmethod
15-
def from_bytes(cls, bytes, filename = None, mime_type = None):
15+
def from_bytes(cls, bytes, filename, mime_type = None):
1616
instance = cls()
1717
instance.data = bytes
1818
instance.filename = filename

templates/ruby/docs/example.md.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require '{{ spec.title }}'
1+
require '{{ spec.title | lower }}'
22

33
include {{ spec.title | caseUcfirst }}
44

@@ -14,4 +14,4 @@ client = Client.new
1414

1515
response = {{ service.name | caseSnake }}.{{ method.name | caseSnake }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{parameter.name|caseSnake}}: {% if parameter.type == 'file' %}{{ parameter | paramExample }}{% else %}{{ parameter | paramExample }}{% endif %}{% endif %}{% endfor %})
1616

17-
puts response.inspect
17+
puts response.inspect

templates/ruby/lib/container/client.rb.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ module {{ spec.title | caseUcfirst }}
205205

206206
headers = @headers.merge(headers)
207207

208+
params.compact!
209+
208210
@boundary = "----A30#3ad1"
209211
if method != "GET"
210212
case headers[:'content-type']

templates/ruby/lib/container/models/model.rb.twig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ module {{ spec.title | caseUcfirst }}
77
{% for property in definition.properties %}
88
attr_reader :{{ property.name | caseSnake | escapeKeyword }}
99
{% endfor %}
10+
{% if definition.additionalProperties %}
11+
attr_reader :data
12+
{% endif %}
1013

1114
def initialize(
1215
{% for property in definition.properties %}
@@ -32,7 +35,7 @@ module {{ spec.title | caseUcfirst }}
3235

3336
{% endfor %}
3437
{% if definition.additionalProperties %}
35-
data: map["data"]
38+
data: map
3639
{% endif %}
3740
)
3841
end
@@ -68,4 +71,4 @@ module {{ spec.title | caseUcfirst }}
6871
{% endfor %}
6972
end
7073
end
71-
end
74+
end

tests/Android14Java11Test.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
class Android14Java11Test extends Base
6+
{
7+
protected string $sdkName = 'android';
8+
protected string $sdkPlatform = 'client';
9+
protected string $sdkLanguage = 'android';
10+
protected string $version = '0.0.1';
11+
12+
protected string $language = 'android';
13+
protected string $class = 'Appwrite\SDK\Language\Android';
14+
protected array $build = [
15+
'mkdir -p tests/sdks/android/library/src/test/java',
16+
'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt',
17+
'chmod +x tests/sdks/android/gradlew',
18+
];
19+
protected string $command =
20+
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/android alvrme/alpine-android:android-34-jdk11 sh -c "./gradlew :library:testReleaseUnitTest --stacktrace -q && cat library/result.txt"';
21+
22+
protected array $expectedOutput = [
23+
...Base::FOO_RESPONSES,
24+
...Base::BAR_RESPONSES,
25+
...Base::GENERAL_RESPONSES,
26+
...Base::LARGE_FILE_RESPONSES,
27+
...Base::LARGE_FILE_RESPONSES,
28+
...Base::LARGE_FILE_RESPONSES,
29+
...Base::EXCEPTION_RESPONSES,
30+
...Base::REALTIME_RESPONSES,
31+
// ...Base::COOKIE_RESPONSES,
32+
...Base::QUERY_HELPER_RESPONSES,
33+
...Base::PERMISSION_HELPER_RESPONSES,
34+
...Base::ID_HELPER_RESPONSES
35+
];
36+
}

tests/Android14Java8Test.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
class Android14Java8Test extends Base
6+
{
7+
protected string $sdkName = 'android';
8+
protected string $sdkPlatform = 'client';
9+
protected string $sdkLanguage = 'android';
10+
protected string $version = '0.0.1';
11+
12+
protected string $language = 'android';
13+
protected string $class = 'Appwrite\SDK\Language\Android';
14+
protected array $build = [
15+
'mkdir -p tests/sdks/android/library/src/test/java',
16+
'cp tests/languages/android/Tests.kt tests/sdks/android/library/src/test/java/Tests.kt',
17+
'chmod +x tests/sdks/android/gradlew',
18+
];
19+
protected string $command =
20+
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/android alvrme/alpine-android:android-34-jdk8 sh -c "./gradlew :library:testReleaseUnitTest --stacktrace -q && cat library/result.txt"';
21+
22+
protected array $expectedOutput = [
23+
...Base::FOO_RESPONSES,
24+
...Base::BAR_RESPONSES,
25+
...Base::GENERAL_RESPONSES,
26+
...Base::LARGE_FILE_RESPONSES,
27+
...Base::LARGE_FILE_RESPONSES,
28+
...Base::LARGE_FILE_RESPONSES,
29+
...Base::EXCEPTION_RESPONSES,
30+
...Base::REALTIME_RESPONSES,
31+
// ...Base::COOKIE_RESPONSES,
32+
...Base::QUERY_HELPER_RESPONSES,
33+
...Base::PERMISSION_HELPER_RESPONSES,
34+
...Base::ID_HELPER_RESPONSES
35+
];
36+
}

0 commit comments

Comments
 (0)