mirror of
https://github.com/tribufu/tribufu-dotnet
synced 2025-06-16 02:14:18 +00:00
Update TribufuApi.cs
This commit is contained in:
@ -22,22 +22,9 @@ namespace Tribufu
|
|||||||
public const string DefaultBaseUrl = "https://api.tribufu.com";
|
public const string DefaultBaseUrl = "https://api.tribufu.com";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a <see cref="TribufuApi"/> with the default options.
|
/// Create a <see cref="TribufuApi"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><see cref="TribufuApi"/> instance with default configuration</returns>
|
public TribufuApi(string? apiKey = null) : base(CreateConfiguration(apiKey))
|
||||||
public TribufuApi() : this(string.Empty)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a <see cref="TribufuApi"/> with the given API key.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// A API key gives you public read only access to the Tribufu API.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="apiKey">The API key for authentication</param>
|
|
||||||
/// <returns><see cref="TribufuApi"/> instance configured with the API key</returns>
|
|
||||||
public TribufuApi(string apiKey) : base(CreateConfiguration(apiKey))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +105,7 @@ namespace Tribufu
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user agent string for the Tribufu API client.
|
/// Gets the user agent string for the Tribufu API client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string GetUserAgent()
|
public static string GetUserAgent()
|
||||||
{
|
{
|
||||||
var version = GetVersion();
|
var version = GetVersion();
|
||||||
var frameworkDescription = RuntimeInformation.FrameworkDescription.Trim();
|
var frameworkDescription = RuntimeInformation.FrameworkDescription.Trim();
|
||||||
@ -126,6 +113,19 @@ namespace Tribufu
|
|||||||
return $"Tribufu/{version} ({frameworkDescription}; {runtimeIdentifier})";
|
return $"Tribufu/{version} ({frameworkDescription}; {runtimeIdentifier})";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if debug mode is enabled.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if debug mode is enabled, otherwise false</returns>
|
||||||
|
public static bool DebugEnabled()
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the base URL for the Tribufu API.
|
/// Get the base URL for the Tribufu API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -147,23 +147,10 @@ namespace Tribufu
|
|||||||
return DefaultBaseUrl;
|
return DefaultBaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks if debug mode is enabled.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if debug mode is enabled, otherwise false</returns>
|
|
||||||
private static bool DebugEnabled()
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user