Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/SDK/Language/CSharp.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function getParamExample(array $param)
$output .= 'false';
break;
case self::TYPE_STRING:
$output .= "''";
$output .= '""';
break;
case self::TYPE_OBJECT:
$output .= 'new Object()';
Expand All @@ -217,7 +217,7 @@ public function getParamExample(array $param)
$output .= ($example) ? 'true' : 'false';
break;
case self::TYPE_STRING:
$output .= "'{$example}'";
$output .= "\"{$example}\"";
break;
}
}
Expand Down Expand Up @@ -249,6 +249,12 @@ public function getFiles()
'template' => '/csharp/LICENSE.twig',
'minify' => false,
],
[
'scope' => 'method',
'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md',
'template' => '/csharp/docs/example.md.twig',
'minify' => false,
],
[
'scope' => 'default',
'destination' => '/src/Appwrite.sln',
Expand Down
17 changes: 17 additions & 0 deletions templates/csharp/docs/example.md.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use {{ spec.title | caseUcfirst }};

Client client = new Client();

{% if method.security|length > 0 %}
client
.SetEndPoint("https://[HOSTNAME_OR_IP]/v1") # Your API Endpoint
{% for node in method.security %}
{% for key,header in node|keys %}
.Set{{header | caseUcfirst}}("{{node[header]["x-appwrite"]["demo"]}}") # {{node[header].description}}
{% endfor %}
{% endfor %};

{% endif %}
{{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client);

result = {{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if parameter.required %}{% if not loop.first %}, {% endif %}{{ parameter | paramExample }}{% endif %}{% endfor %});