mirror of
https://github.com/jellyfin/jellyfin-sdk-csharp.git
synced 2024-11-23 05:39:51 +00:00
Update to dotnet7, update nswag
This commit is contained in:
parent
a987fc21c5
commit
dbd9bab02a
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
@ -12,7 +12,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Jellyfin.Sdk" Version="10.7.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
@ -21,7 +21,7 @@
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Description>Auto generated sdk for Jellyfin.</Description>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'">
|
||||
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
|
||||
<IsTrimmable>true</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
@ -33,11 +33,11 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NSwag.MSBuild" Version="13.15.10">
|
||||
<PackageReference Include="NSwag.MSBuild" Version="13.17.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Text.Json" Version="6.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup>
|
||||
|
@ -95,7 +95,6 @@
|
||||
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 %}
|
||||
@ -114,56 +113,6 @@
|
||||
}
|
||||
|
||||
{% 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 -%}
|
||||
|
||||
PrepareRequestUrl(urlBuilder_);
|
||||
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 %}
|
||||
@ -261,8 +210,12 @@
|
||||
var dictionary_ = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.Dictionary<string, string>>(json_, _settings.Value);
|
||||
var content_ = new System.Net.Http.FormUrlEncodedContent(dictionary_);
|
||||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("{{ operation.Consumes }}");
|
||||
{% elsif operation.HasPlainTextBodyParameter -%}
|
||||
var content_ = new System.Net.Http.StringContent({{ operation.ContentParameter.VariableName }});
|
||||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("{{ operation.Consumes }}");
|
||||
{% else -%}
|
||||
var content_ = new System.Net.Http.StringContent({% if UseSystemTextJson %}System.Text.Json.JsonSerializer.Serialize{% else %}Newtonsoft.Json.JsonConvert.SerializeObject{% endif %}({{ operation.ContentParameter.VariableName }}, {% if SerializeTypeInformation %}typeof({{ operation.ContentParameter.Type }}), {% endif %}{% if UseRequestAndResponseSerializationSettings %}_requestSettings{% else %}_settings{% endif %}.Value));
|
||||
var json_ = {% if UseSystemTextJson %}System.Text.Json.JsonSerializer.Serialize{% else %}Newtonsoft.Json.JsonConvert.SerializeObject{% endif %}({{ operation.ContentParameter.VariableName }}, {% if SerializeTypeInformation %}typeof({{ operation.ContentParameter.Type }}), {% endif %}{% if UseRequestAndResponseSerializationSettings %}_requestSettings{% else %}_settings{% endif %}.Value);
|
||||
var content_ = new System.Net.Http.StringContent(json_);
|
||||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("{{ operation.Consumes }}");
|
||||
{% endif -%}
|
||||
request_.Content = content_;
|
||||
@ -316,7 +269,8 @@
|
||||
content_.Add(new System.Net.Http.StringContent(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture)), "{{ parameter.Name }}");
|
||||
}
|
||||
{% elsif parameter.IsObject -%}
|
||||
content_.Add(new System.Net.Http.StringContent({% if UseSystemTextJson %}System.Text.Json.JsonSerializer.Serialize{% else %}Newtonsoft.Json.JsonConvert.SerializeObject{% endif %}({{ parameter.VariableName }}, {% if UseRequestAndResponseSerializationSettings %}_requestSettings{% else %}_settings{% endif %}.Value)), "{{ parameter.Name }}");
|
||||
var json_ = {% if UseSystemTextJson %}System.Text.Json.JsonSerializer.Serialize{% else %}Newtonsoft.Json.JsonConvert.SerializeObject{% endif %}({{ parameter.VariableName }}, {% if UseRequestAndResponseSerializationSettings %}_requestSettings{% else %}_settings{% endif %}.Value);
|
||||
content_.Add(new System.Net.Http.StringContent(json_), "{{ parameter.Name }}");
|
||||
{% else -%}
|
||||
content_.Add(new System.Net.Http.StringContent(ConvertToString({{ parameter.VariableName }}, System.Globalization.CultureInfo.InvariantCulture)), "{{ parameter.Name }}");
|
||||
{% endif -%}
|
||||
@ -334,7 +288,7 @@
|
||||
{% endif -%}
|
||||
|
||||
{% if GeneratePrepareRequestAndProcessResponseAsAsyncMethods %}
|
||||
await PrepareRequestAsync(client_, request_, urlBuilder_).ConfigureAwait(false);
|
||||
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
||||
{% else -%}
|
||||
PrepareRequest(client_, request_, urlBuilder_);
|
||||
{% endif -%}
|
||||
@ -343,7 +297,7 @@
|
||||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||||
|
||||
{% if GeneratePrepareRequestAndProcessResponseAsAsyncMethods -%}
|
||||
await PrepareRequestAsync(client_, request_, url_).ConfigureAwait(false);
|
||||
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
||||
{% else -%}
|
||||
PrepareRequest(client_, request_, url_);
|
||||
{% endif -%}
|
||||
|
@ -4,7 +4,6 @@ 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 %}
|
||||
@ -17,16 +16,10 @@ 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 %}
|
||||
{{ operation.ResultType }} {{ operation.ActualOperationName }}Async({% for parameter in operation.Parameters %}{{ parameter.Type }} {{ parameter.VariableName }}{% if GenerateOptionalParameters and parameter.IsOptional %} = null{% endif %}, {% endfor %}System.Threading.CancellationToken cancellationToken{% if GenerateOptionalParameters %} = default(System.Threading.CancellationToken){% endif %});
|
||||
|
||||
{% endfor -%}
|
||||
}
|
||||
}
|
@ -3,6 +3,11 @@
|
||||
/// {{ operation.Summary | csharpdocs }}
|
||||
/// </summary>
|
||||
{% endif -%}
|
||||
{% if operation.HasDescription -%}
|
||||
/// <remarks>
|
||||
/// {{ operation.Description | csharpdocs }}
|
||||
/// </remarks>
|
||||
{% endif -%}
|
||||
{% for parameter in operation.Parameters -%}
|
||||
{% if parameter.HasDescription -%}
|
||||
/// <param name="{{ parameter.VariableIdentifier }}">{{ parameter.Description | csharpdocs }}</param>
|
||||
|
@ -8,6 +8,11 @@ public interface I{{ Class }}Controller
|
||||
/// {{ operation.Summary | csharpdocs }}
|
||||
/// </summary>
|
||||
{%- endif %}
|
||||
{% if operation.HasDescription -%}
|
||||
/// <remarks>
|
||||
/// {{ operation.Description | csharpdocs }}
|
||||
/// </remarks>
|
||||
{% endif -%}
|
||||
{%- for parameter in operation.Parameters %}
|
||||
{%- if parameter.HasDescription %}
|
||||
/// <param name="{{ parameter.VariableName }}">{{ parameter.Description | csharpdocs }}</param>
|
||||
@ -50,6 +55,11 @@ public partial class {{ Class }}Controller : {% if HasBaseClass %}{{ BaseClass }
|
||||
/// {{ operation.Summary | csharpdocs }}
|
||||
/// </summary>
|
||||
{% endif -%}
|
||||
{% if operation.HasDescription -%}
|
||||
/// <remarks>
|
||||
/// {{ operation.Description | csharpdocs }}
|
||||
/// </remarks>
|
||||
{% endif -%}
|
||||
{% for parameter in operation.Parameters -%}
|
||||
{% if parameter.HasDescription -%}
|
||||
/// <param name="{{ parameter.VariableName }}">{{ parameter.Description | csharpdocs }}</param>
|
||||
@ -102,6 +112,11 @@ public abstract class {{ Class }}ControllerBase : {% if HasBaseClass %}{{ BaseCl
|
||||
/// {{ operation.Summary | csharpdocs }}
|
||||
/// </summary>
|
||||
{% endif -%}
|
||||
{% if operation.HasDescription -%}
|
||||
/// <remarks>
|
||||
/// {{ operation.Description | csharpdocs }}
|
||||
/// </remarks>
|
||||
{% endif -%}
|
||||
{% for parameter in operation.Parameters -%}
|
||||
{% if parameter.HasDescription -%}
|
||||
/// <param name="{{ parameter.VariableName }}">{{ parameter.Description | csharpdocs }}</param>
|
||||
|
Loading…
Reference in New Issue
Block a user