mirror of
https://github.com/tribufu/proxmox-sharp
synced 2026-05-06 06:47:29 +00:00
Add support to net472
This commit is contained in:
parent
9faee52854
commit
9d4aaf6692
8 changed files with 1983 additions and 1985 deletions
|
|
@ -3,11 +3,11 @@
|
||||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="dotenv.net" Version="3.2.0" />
|
<PackageVersion Include="dotenv.net" Version="4.0.0" />
|
||||||
<PackageVersion Include="JsonSubTypes" Version="2.0.1" />
|
<PackageVersion Include="JsonSubTypes" Version="2.0.1" />
|
||||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageVersion Include="Polly" Version="8.1.0" />
|
<PackageVersion Include="Polly" Version="8.1.0" />
|
||||||
<PackageVersion Include="RestSharp" Version="112.1.0" />
|
<PackageVersion Include="RestSharp" Version="113.0.0" />
|
||||||
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate `
|
||||||
-g csharp `
|
-g csharp `
|
||||||
-o . `
|
-o . `
|
||||||
--global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false `
|
--global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false `
|
||||||
--additional-properties=packageName=ProxmoxSharp,library=restsharp,zeroBasedEnums=true,nullableReferenceTypes=true `
|
--additional-properties=targetFramework=net47,packageName=ProxmoxSharp,library=restsharp,zeroBasedEnums=true `
|
||||||
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=ProxmoxGenerated `
|
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=ProxmoxGenerated `
|
||||||
--type-mappings Any=object `
|
--type-mappings Any=object `
|
||||||
--skip-validate-spec
|
--skip-validate-spec
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -23,6 +23,7 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
|
|
|
||||||
|
|
@ -101,12 +101,6 @@ namespace ProxmoxSharp.Client
|
||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
// For example: 2009-06-15T13:45:30.0000000
|
||||||
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
||||||
if (obj is DateOnly dateOnly)
|
|
||||||
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
|
||||||
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
|
||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
|
||||||
// For example: 2009-06-15
|
|
||||||
return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
|
|
||||||
if (obj is bool boolean)
|
if (obj is bool boolean)
|
||||||
return boolean ? "true" : "false";
|
return boolean ? "true" : "false";
|
||||||
if (obj is ICollection collection) {
|
if (obj is ICollection collection) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace ProxmoxSharp
|
||||||
/// // Environment variable PROXMOX_API_KEY must be set
|
/// // Environment variable PROXMOX_API_KEY must be set
|
||||||
/// var api = ProxmoxApi.FromEnv();
|
/// var api = ProxmoxApi.FromEnv();
|
||||||
/// </example>
|
/// </example>
|
||||||
public static ProxmoxApi? FromEnv()
|
public static ProxmoxApi FromEnv()
|
||||||
{
|
{
|
||||||
var baseUrl = Environment.GetEnvironmentVariable("PROXMOX_URL");
|
var baseUrl = Environment.GetEnvironmentVariable("PROXMOX_URL");
|
||||||
var tokenId = Environment.GetEnvironmentVariable("PROXMOX_TOKEN_ID");
|
var tokenId = Environment.GetEnvironmentVariable("PROXMOX_TOKEN_ID");
|
||||||
|
|
@ -65,8 +65,8 @@ namespace ProxmoxSharp
|
||||||
{
|
{
|
||||||
var version = GetVersion();
|
var version = GetVersion();
|
||||||
var frameworkDescription = RuntimeInformation.FrameworkDescription.Trim();
|
var frameworkDescription = RuntimeInformation.FrameworkDescription.Trim();
|
||||||
var runtimeIdentifier = RuntimeInformation.RuntimeIdentifier.Trim();
|
//var runtimeIdentifier = RuntimeInformation.RuntimeIdentifier.Trim();
|
||||||
return $"Proxmox/{version} ({frameworkDescription}; {runtimeIdentifier})";
|
return $"ProxmoxSharp/{version} ({frameworkDescription})";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,18 @@ namespace ProxmoxSharp
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static class ProxmoxApiSingleton
|
public static class ProxmoxApiSingleton
|
||||||
{
|
{
|
||||||
private static ProxmoxApi? _instance = null;
|
private static ProxmoxApi _instance = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the singleton instance of <see cref="ProxmoxApi"/>.
|
/// Get the singleton instance of <see cref="ProxmoxApi"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ProxmoxApi GetInstance()
|
public static ProxmoxApi GetInstance()
|
||||||
{
|
{
|
||||||
//_instance ??= ProxmoxApi.FromEnvOrDefault();
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = ProxmoxApi.FromEnv();
|
||||||
|
}
|
||||||
|
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,8 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<IsPublishable>false</IsPublishable>
|
<IsPublishable>false</IsPublishable>
|
||||||
<Nullable>annotations</Nullable>
|
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net472;net5.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
|
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue