Skip to content

Commit 00306be

Browse files
committed
Import input files where required for docs
1 parent f986926 commit 00306be

File tree

7 files changed

+19
-1
lines changed

7 files changed

+19
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import android.os.Bundle
33
import kotlinx.coroutines.GlobalScope
44
import kotlinx.coroutines.launch
55
import {{ sdk.namespace | caseDot }}.Client
6+
{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %}
7+
import {{ sdk.namespace | caseDot }}.models.InputFile
8+
{% endif %}
69
import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }}
710

811
public class MainActivity extends AppCompatActivity {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import android.os.Bundle
33
import kotlinx.coroutines.GlobalScope
44
import kotlinx.coroutines.launch
55
import {{ sdk.namespace | caseDot }}.Client
6+
{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %}
7+
import {{ sdk.namespace | caseDot }}.models.InputFile
8+
{% endif %}
69
import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }}
710

811
class MainActivity : AppCompatActivity() {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import {{ sdk.namespace | caseDot }}.Client
2+
{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %}
3+
import {{ sdk.namespace | caseDot }}.models.InputFile
4+
{% endif %}
25
import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }}
36

47
public void main() {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import {{ sdk.namespace | caseDot }}.Client
2+
{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %}
3+
import {{ sdk.namespace | caseDot }}.models.InputFile
4+
{% endif %}
25
import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }}
36

47
suspend fun main() {

templates/php/docs/example.md.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22
33
use {{ spec.title | caseUcfirst }}\Client;
4+
{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %}
5+
use {{ spec.title | caseUcfirst }}\InputFile;
6+
{% endif %}
47
use {{ spec.title | caseUcfirst }}\Services\{{ service.name | caseUcfirst }};
58
69
$client = new Client();

templates/python/docs/example.md.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
from {{ spec.title | caseSnake }}.client import Client
2+
{% if method.parameters.all | filter((param) => param.type == 'file') | length > 0 %}
3+
from {{ spec.title | caseSnake }}.input_file import InputFile
4+
{% endif %}
25
from {{ spec.title | caseSnake }}.services.{{ service.name | caseSnake }} import {{ service.name | caseUcfirst }}
36

47
client = Client()

templates/ruby/docs/example.md.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ client
1212

1313
{{ service.name | caseSnake }} = {{spec.title | caseUcfirst}}::{{ service.name | caseUcfirst }}.new(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %})
1414

15-
response = {{ service.name | caseSnake }}.{{ method.name | caseSnake }}({% for parameter in method.parameters.all | filter((param) => not param.isGlobal) %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{parameter.name|caseSnake}}: {% if parameter | paramExample == "InputFile.new" %}{{spec.title | caseUcfirst}}::{{ parameter | paramExample }}{% else %}{{ parameter | paramExample }}{% endif %}{% endif %}{% endfor %})
15+
response = {{ service.name | caseSnake }}.{{ method.name | caseSnake }}({% for parameter in method.parameters.all | filter((param) => not param.isGlobal) %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{parameter.name|caseSnake}}: {% if parameter.type == 'file' %}{{spec.title | caseUcfirst}}::{{ parameter | paramExample }}{% else %}{{ parameter | paramExample }}{% endif %}{% endif %}{% endfor %})
1616

1717
puts response.inspect

0 commit comments

Comments
 (0)