mirror of
https://github.com/tribufu/tribufu-dotnet
synced 2026-02-04 10:46:34 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87334bb28c | |||
| d26c3bd11a | |||
| e3c42a9911 |
@@ -6,7 +6,7 @@
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/tribufu/tribufu-dotnet</RepositoryUrl>
|
||||
<Version>1.2.0</Version>
|
||||
<Version>1.2.1</Version>
|
||||
<AssemblyVersion>$(Version).0</AssemblyVersion>
|
||||
<NoWarn>$(NoWarn);0618;1591;1998;2002;8767</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[![MIT License][mit-badge]][mit-url]
|
||||
[![Discord Chat][discord-badge]][discord-url]
|
||||
|
||||
[nuget-badge]: https://img.shields.io/nuget/v/tribufu.svg
|
||||
[nuget-badge]: https://img.shields.io/nuget/v/Tribufu.svg
|
||||
[nuget-url]: https://www.nuget.org/packages/Tribufu
|
||||
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
[mit-url]: https://github.com/tribufu/tribufu-dotnet/blob/main/LICENSE.txt
|
||||
|
||||
@@ -7,6 +7,6 @@ java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate `
|
||||
-g csharp `
|
||||
-o . `
|
||||
--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 `
|
||||
--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.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using RestSharp;
|
||||
|
||||
@@ -101,12 +101,6 @@ namespace Tribufu.Client
|
||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||
// For example: 2009-06-15T13:45:30.0000000
|
||||
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)
|
||||
return boolean ? "true" : "false";
|
||||
if (obj is ICollection collection) {
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Tribufu.Model
|
||||
/// <param name="viewCount">viewCount.</param>
|
||||
/// <param name="created">created.</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.Uuid = uuid;
|
||||
@@ -127,7 +127,8 @@ namespace Tribufu.Model
|
||||
/// Gets or Sets Birthday
|
||||
/// </summary>
|
||||
[DataMember(Name = "birthday", EmitDefaultValue = true)]
|
||||
public DateOnly? Birthday { get; set; }
|
||||
[JsonConverter(typeof(OpenAPIDateConverter))]
|
||||
public DateTime? Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Points
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
# Tribufu
|
||||
@@ -9,12 +9,11 @@
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<IsPublishable>false</IsPublishable>
|
||||
<Nullable>annotations</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0;net472;net5.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JsonSubTypes" />
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Tribufu
|
||||
/// <summary>
|
||||
/// Create a <see cref="TribufuApi"/> instance.
|
||||
/// </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
|
||||
/// var api = TribufuApi.FromEnv();
|
||||
/// </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");
|
||||
|
||||
@@ -110,8 +113,8 @@ namespace Tribufu
|
||||
{
|
||||
var version = GetVersion();
|
||||
var frameworkDescription = RuntimeInformation.FrameworkDescription.Trim();
|
||||
var runtimeIdentifier = RuntimeInformation.RuntimeIdentifier.Trim();
|
||||
return $"Tribufu/{version} ({frameworkDescription}; {runtimeIdentifier})";
|
||||
//var runtimeIdentifier = RuntimeInformation.RuntimeIdentifier.Trim();
|
||||
return $"Tribufu/{version} ({frameworkDescription})"; //; {runtimeIdentifier})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -151,7 +154,7 @@ namespace Tribufu
|
||||
/// <summary>
|
||||
/// Creates a configuration for the Tribufu API client.
|
||||
/// </summary>
|
||||
private static Configuration CreateConfiguration(string? apiKey)
|
||||
private static Configuration CreateConfiguration(string apiKey)
|
||||
{
|
||||
var config = new Configuration
|
||||
{
|
||||
|
||||
@@ -11,14 +11,18 @@ namespace Tribufu
|
||||
/// </remarks>
|
||||
public static class TribufuApiSingleton
|
||||
{
|
||||
private static TribufuApi? _instance = null;
|
||||
private static TribufuApi _instance = null;
|
||||
|
||||
/// <summary>
|
||||
/// Get the singleton instance of <see cref="TribufuApi"/>.
|
||||
/// </summary>
|
||||
public static TribufuApi GetInstance()
|
||||
{
|
||||
_instance ??= TribufuApi.FromEnvOrDefault();
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = TribufuApi.FromEnvOrDefault();
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user