mirror of
https://github.com/tribufu/tribufu-dotnet
synced 2026-02-04 02:36:55 +00:00
Add support to dotnet standard and framework
This commit is contained in:
@@ -7,6 +7,6 @@ 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=Tribufu,library=restsharp,zeroBasedEnums=true,nullableReferenceTypes=true `
|
--additional-properties=packageName=Tribufu,library=restsharp,targetFramework=net47,zeroBasedEnums=true `
|
||||||
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated `
|
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated `
|
||||||
--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 Tribufu.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) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Tribufu.Model
|
|||||||
/// <param name="viewCount">viewCount.</param>
|
/// <param name="viewCount">viewCount.</param>
|
||||||
/// <param name="created">created.</param>
|
/// <param name="created">created.</param>
|
||||||
/// <param name="updated">updated.</param>
|
/// <param name="updated">updated.</param>
|
||||||
public Profile(string id = default(string), Guid uuid = default(Guid), string name = default(string), string displayName = default(string), bool verified = default(bool), int level = default(int), double experience = default(double), bool publicBirthday = default(bool), DateOnly? birthday = default(DateOnly?), double points = default(double), string location = default(string), string photoUrl = default(string), string bannerUrl = default(string), DateTime? lastOnline = default(DateTime?), string biography = default(string), int viewCount = default(int), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
|
public Profile(string id = default(string), Guid uuid = default(Guid), string name = default(string), string displayName = default(string), bool verified = default(bool), int level = default(int), double experience = default(double), bool publicBirthday = default(bool), DateTime? birthday = default(DateTime?), double points = default(double), string location = default(string), string photoUrl = default(string), string bannerUrl = default(string), DateTime? lastOnline = default(DateTime?), string biography = default(string), int viewCount = default(int), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
|
||||||
{
|
{
|
||||||
this.Id = id;
|
this.Id = id;
|
||||||
this.Uuid = uuid;
|
this.Uuid = uuid;
|
||||||
@@ -127,7 +127,8 @@ namespace Tribufu.Model
|
|||||||
/// Gets or Sets Birthday
|
/// Gets or Sets Birthday
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name = "birthday", EmitDefaultValue = true)]
|
[DataMember(Name = "birthday", EmitDefaultValue = true)]
|
||||||
public DateOnly? Birthday { get; set; }
|
[JsonConverter(typeof(OpenAPIDateConverter))]
|
||||||
|
public DateTime? Birthday { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Points
|
/// Gets or Sets Points
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
# Tribufu
|
|
||||||
@@ -9,12 +9,11 @@
|
|||||||
<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="\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JsonSubTypes" />
|
<PackageReference Include="JsonSubTypes" />
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Tribufu
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a <see cref="TribufuApi"/> instance.
|
/// Create a <see cref="TribufuApi"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TribufuApi(string? apiKey = null) : base(CreateConfiguration(apiKey))
|
public TribufuApi(string apiKey = null) : base(CreateConfiguration(apiKey))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,9 +63,12 @@ namespace Tribufu
|
|||||||
/// // Environment variable TRIBUFU_API_KEY must be set
|
/// // Environment variable TRIBUFU_API_KEY must be set
|
||||||
/// var api = TribufuApi.FromEnv();
|
/// var api = TribufuApi.FromEnv();
|
||||||
/// </example>
|
/// </example>
|
||||||
public static TribufuApi? FromEnv(string? prefix = null)
|
public static TribufuApi FromEnv(string prefix = null)
|
||||||
{
|
{
|
||||||
prefix ??= "TRIBUFU";
|
if (prefix == null)
|
||||||
|
{
|
||||||
|
prefix = "TRIBUFU";
|
||||||
|
}
|
||||||
|
|
||||||
var apiKey = Environment.GetEnvironmentVariable($"{prefix}_API_KEY");
|
var apiKey = Environment.GetEnvironmentVariable($"{prefix}_API_KEY");
|
||||||
|
|
||||||
@@ -110,8 +113,8 @@ namespace Tribufu
|
|||||||
{
|
{
|
||||||
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 $"Tribufu/{version} ({frameworkDescription}; {runtimeIdentifier})";
|
return $"Tribufu/{version} ({frameworkDescription})"; //; {runtimeIdentifier})";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -151,7 +154,7 @@ namespace Tribufu
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a configuration for the Tribufu API client.
|
/// Creates a configuration for the Tribufu API client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static Configuration CreateConfiguration(string? apiKey)
|
private static Configuration CreateConfiguration(string apiKey)
|
||||||
{
|
{
|
||||||
var config = new Configuration
|
var config = new Configuration
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,14 +11,18 @@ namespace Tribufu
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static class TribufuApiSingleton
|
public static class TribufuApiSingleton
|
||||||
{
|
{
|
||||||
private static TribufuApi? _instance = null;
|
private static TribufuApi _instance = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the singleton instance of <see cref="TribufuApi"/>.
|
/// Get the singleton instance of <see cref="TribufuApi"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static TribufuApi GetInstance()
|
public static TribufuApi GetInstance()
|
||||||
{
|
{
|
||||||
_instance ??= TribufuApi.FromEnvOrDefault();
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = TribufuApi.FromEnvOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user