mirror of
https://github.com/jellyfin/jellyfin-sdk-csharp.git
synced 2024-11-23 05:39:51 +00:00
apply template patch
This commit is contained in:
parent
d585c62887
commit
162b70d43e
@ -95,6 +95,7 @@
|
||||
partial void ProcessResponse({{ HttpClientType }} client, System.Net.Http.HttpResponseMessage response);
|
||||
{% endif -%}
|
||||
{% for operation in Operations %}
|
||||
{% assign http_method = operation.HttpMethodUpper | upcase %}
|
||||
{% if GenerateOptionalParameters == false -%}
|
||||
{% template Client.Method.Documentation %}
|
||||
{% template Client.Method.Annotations %}
|
||||
@ -113,6 +114,55 @@
|
||||
}
|
||||
|
||||
{% endif -%}
|
||||
{%- if http_method == 'GET' and operation.SyncResultType == 'FileResponse' -%}
|
||||
{% template Client.Method.Documentation %}
|
||||
{% template Client.Method.Annotations %}
|
||||
{{ operation.MethodAccessModifier }} virtual string {{ operation.ActualOperationName }}Url({% for parameter in operation.Parameters %}{{ parameter.Type }} {{ parameter.VariableName }}{% if GenerateOptionalParameters and parameter.IsOptional %} = null{% endif %}{% if parameter.IsLast == false %}, {% endif %}{% endfor %})
|
||||
{
|
||||
{% for parameter in operation.PathParameters -%}
|
||||
{% if parameter.IsNullable == false and parameter.IsRequired -%}
|
||||
if ({{ parameter.VariableName }} == null)
|
||||
throw new System.ArgumentNullException("{{ parameter.VariableName }}");
|
||||
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% for parameter in operation.QueryParameters -%}
|
||||
{% if parameter.IsNullable == false and parameter.IsRequired -%}
|
||||
if ({{ parameter.VariableName }} == null)
|
||||
throw new System.ArgumentNullException("{{ parameter.VariableName }}");
|
||||
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
|
||||
var urlBuilder_ = new System.Text.StringBuilder();
|
||||
urlBuilder_.Append({% if UseBaseUrl %}BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/{% else %}"{% endif %}{{ operation.Path }}{% if operation.HasQueryParameters %}?{% endif %}");
|
||||
{% for parameter in operation.PathParameters -%}
|
||||
{% if parameter.IsOptional -%}
|
||||
if ({{ parameter.VariableName }} != null)
|
||||
{% template Client.Class.PathParameter %}
|
||||
else
|
||||
urlBuilder_.Replace("/{{ "{" }}{{ parameter.Name }}}", string.Empty);
|
||||
{% else -%}
|
||||
{% template Client.Class.PathParameter %}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% for parameter in operation.QueryParameters -%}
|
||||
{% if parameter.IsOptional -%}
|
||||
if ({{ parameter.VariableName }} != null)
|
||||
{
|
||||
{% template Client.Class.QueryParameter %}
|
||||
}
|
||||
{% else -%}
|
||||
{% template Client.Class.QueryParameter %}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% if operation.HasQueryParameters -%}
|
||||
urlBuilder_.Length--;
|
||||
{% endif -%}
|
||||
|
||||
return urlBuilder_.ToString();
|
||||
}
|
||||
{% endif -%}
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||||
{% template Client.Method.Documentation %}
|
||||
{% template Client.Method.Annotations %}
|
||||
|
@ -4,6 +4,7 @@ public partial interface I{{ Class }}{% if HasClientBaseInterface %} : {{ Client
|
||||
{
|
||||
{% template Client.Interface.Body %}
|
||||
{% for operation in InterfaceOperations -%}
|
||||
{%- assign http_method = operation.HttpMethodUpper | upcase -%}
|
||||
{% if GenerateOptionalParameters == false -%}
|
||||
{% template Client.Method.Documentation %}
|
||||
{% template Client.Method.Annotations %}
|
||||
@ -16,6 +17,12 @@ public partial interface I{{ Class }}{% if HasClientBaseInterface %} : {{ Client
|
||||
{{ operation.SyncResultType }} {{ operation.ActualOperationName }}({% for parameter in operation.Parameters %}{{ parameter.Type }} {{ parameter.VariableName }}{% if GenerateOptionalParameters and parameter.IsOptional %} = null{% endif %}{% if parameter.IsLast == false %}, {% endif %}{% endfor %});
|
||||
|
||||
{%- endif %}
|
||||
{%- if http_method == 'GET' and operation.SyncResultType == 'FileResponse' -%}
|
||||
{% template Client.Method.Documentation %}
|
||||
{% template Client.Method.Annotations %}
|
||||
string {{ operation.ActualOperationName }}Url({% for parameter in operation.Parameters %}{{ parameter.Type }} {{ parameter.VariableName }}{% if GenerateOptionalParameters and parameter.IsOptional %} = null{% endif %}{% if parameter.IsLast == false %}, {% endif %}{% endfor %});
|
||||
|
||||
{%- endif -%}
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||||
{% template Client.Method.Documentation %}
|
||||
{% template Client.Method.Annotations %}
|
||||
|
Loading…
Reference in New Issue
Block a user