Skip to content

Commit 0a750c2

Browse files
committed
Update web docs
1 parent c3f198f commit 0a750c2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/SDK/SDK.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ public function generate($target)
584584
$params['service'] = [
585585
'name' => $key,
586586
'methods' => $methods,
587+
'globalParams' => $service['globalParams'] ?? [],
587588
'features' => [
588589
'upload' => $this->hasUploads($methods),
589590
'location' => $this->hasLocation($methods),

templates/web/docs/example.md.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {{ '{' }} Client, {{service.name | caseUcfirst}} {{ '}' }} from "{{ langu
22

33
const client = new Client();
44

5-
const {{ service.name | caseCamel }} = new {{service.name | caseUcfirst}}(client);
5+
const {{ service.name | caseCamel }} = new {{service.name | caseUcfirst}}(client{% if service.globalParams | length %}{% for parameter in service.globalParams %}, {{ parameter | paramExample }}{% endfor %}{% endif %});
66

77
{% if method.security|length > 0 %}
88
client
@@ -16,7 +16,7 @@ client
1616
{% endif %}
1717
{% if method.type == 'webAuth' %}// Go to OAuth provider login page
1818
{% endif %}
19-
{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}const result = {% else %}const promise = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %});
19+
{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}const result = {% else %}const promise = {% endif %}{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% for parameter in method.parameters.all | filter((param) => not param.isGlobal) %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %});
2020

2121
{% if method.type == 'webAuth' %}{% elseif method.type == 'location' %}console.log(result); // Resource URL{% else %}promise.then(function (response) {
2222
console.log(response); // Success

0 commit comments

Comments
 (0)