Skip to content

Commit 13aed7c

Browse files
committed
feat(kotlin): fix examples
1 parent 966d464 commit 13aed7c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

templates/android/docs/kotlin/example.md.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MainActivity : AppCompatActivity() {
2323
val {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client)
2424

2525
GlobalScope.launch {
26-
val response = {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %}
26+
{% if method.type == 'webAuth' %} {% elseif method.type == 'location' %} val result = {% else %} val response = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %}
2727

2828
{% for parameter in method.parameters.all %}
2929
{% if parameter.required %}
@@ -34,6 +34,8 @@ class MainActivity : AppCompatActivity() {
3434
)
3535
{% endif %}
3636
{% endfor %}
37+
{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %} println(result); // Resource URL{% else %} val json = response.body?.string(){% endif %}
38+
3739
}
3840
}
3941
}

templates/kotlin/docs/kotlin/example.md.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ suspend fun main() {
1010
.set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}") // {{node[header].description}}
1111
{% endfor %}{% endfor %}{% endif %}
1212

13-
1413
val {{ service.name | caseCamel }} = {{ service.name | caseUcfirst }}(client)
15-
val response = {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %}
14+
{% if method.type == 'webAuth' %} {% elseif method.type == 'location' %} val result = {% else %} val response = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}){% endif %}
1615

1716
{% for parameter in method.parameters.all %}
1817
{% if parameter.required %}
@@ -23,4 +22,6 @@ suspend fun main() {
2322
)
2423
{% endif %}
2524
{% endfor %}
25+
{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %} println(result); // Resource URL{% else %} val json = response.body?.string(){% endif %}
26+
2627
}

0 commit comments

Comments
 (0)