actually save config
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Jellyfin.Plugin.Simkl.API.Responses;
|
||||
using MediaBrowser.Model.Services;
|
||||
#pragma warning disable SA1300
|
||||
|
||||
namespace Jellyfin.Plugin.Simkl.API
|
||||
{
|
||||
@@ -13,6 +14,6 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
/// Gets or sets user code.
|
||||
/// </summary>
|
||||
[ApiMember(Name = "user_code", Description = "pin to be introduced by the user", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||
public string UserCode { get; set; }
|
||||
public string user_code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
#pragma warning disable SA1300
|
||||
|
||||
namespace Jellyfin.Plugin.Simkl.API.Objects
|
||||
{
|
||||
@@ -11,7 +12,7 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
|
||||
/// Gets or sets watched at.
|
||||
/// </summary>
|
||||
[JsonPropertyName("watched_at")]
|
||||
public string WatchedAt { get; set; }
|
||||
public string watched_at { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets ids.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
#pragma warning disable SA1300
|
||||
|
||||
namespace Jellyfin.Plugin.Simkl.API.Objects
|
||||
{
|
||||
@@ -17,7 +18,7 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
|
||||
/// Gets or sets joined at.
|
||||
/// </summary>
|
||||
[JsonPropertyName("joined_at")]
|
||||
public DateTime JoinedAt { get; set; }
|
||||
public DateTime joined_at { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets gender.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
#pragma warning disable SA1300
|
||||
|
||||
namespace Jellyfin.Plugin.Simkl.API.Responses
|
||||
{
|
||||
@@ -16,25 +17,25 @@ namespace Jellyfin.Plugin.Simkl.API.Responses
|
||||
/// Gets or sets device code.
|
||||
/// </summary>
|
||||
[JsonPropertyName("device_code")]
|
||||
public string DeviceCode { get; set; }
|
||||
public string device_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets user code.
|
||||
/// </summary>
|
||||
[JsonPropertyName("user_code")]
|
||||
public string UserCode { get; set; }
|
||||
public string user_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets verification url.
|
||||
/// </summary>
|
||||
[JsonPropertyName("verification_url")]
|
||||
public string VerificationUrl { get; set; }
|
||||
public string verification_url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets expires in.
|
||||
/// </summary>
|
||||
[JsonPropertyName("expires_in")]
|
||||
public int ExpiresIn { get; set; }
|
||||
public int expires_in { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets interval.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
#pragma warning disable SA1300
|
||||
|
||||
namespace Jellyfin.Plugin.Simkl.API.Responses
|
||||
{
|
||||
@@ -21,6 +22,6 @@ namespace Jellyfin.Plugin.Simkl.API.Responses
|
||||
/// Gets or sets access token.
|
||||
/// </summary>
|
||||
[JsonPropertyName("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
public string access_token { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
#pragma warning disable SA1300
|
||||
|
||||
namespace Jellyfin.Plugin.Simkl.API.Responses
|
||||
{
|
||||
@@ -16,6 +17,6 @@ namespace Jellyfin.Plugin.Simkl.API.Responses
|
||||
/// Gets or sets not found.
|
||||
/// </summary>
|
||||
[JsonPropertyName("not_found")]
|
||||
public SyncHistoryNotFound NotFound { get; set; }
|
||||
public SyncHistoryNotFound not_found { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Jellyfin.Plugin.Simkl.API.Objects;
|
||||
using Jellyfin.Plugin.Simkl.API.Responses;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Services;
|
||||
@@ -14,20 +15,20 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
public class ServerEndpoint : IService, IHasResultFactory
|
||||
{
|
||||
private readonly SimklApi _api;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ServerEndpoint> _logger;
|
||||
private readonly IJsonSerializer _json;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ServerEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="api">The simkl api.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{ServerEndpoint}"/> interface.</param>
|
||||
/// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
|
||||
/// <param name="json">Instance of the <see cref="IJsonSerializer"/> interface.</param>
|
||||
public ServerEndpoint(SimklApi api, ILogger logger, IJsonSerializer json)
|
||||
/// <param name="httpClient">Instance of the <see cref="IHttpClient"/> interface.</param>
|
||||
public ServerEndpoint(ILoggerFactory loggerFactory, IJsonSerializer json, IHttpClient httpClient)
|
||||
{
|
||||
_api = api;
|
||||
_logger = logger;
|
||||
_logger = loggerFactory.CreateLogger<ServerEndpoint>();
|
||||
_json = json;
|
||||
_api = new SimklApi(json, loggerFactory.CreateLogger<SimklApi>(), httpClient);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -57,7 +58,7 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
/// <returns>Code status response.</returns>
|
||||
public CodeStatusResponse Get(GetPinStatus request)
|
||||
{
|
||||
return _api.GetCodeStatus(request.UserCode).GetAwaiter().GetResult();
|
||||
return _api.GetCodeStatus(request.user_code).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,7 +69,7 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
public UserSettings Get(GetUserSettings request)
|
||||
{
|
||||
_logger.LogDebug(_json.SerializeToString(request));
|
||||
return _api.GetUserSettings(SimklPlugin.Instance.Configuration.GetByGuid(request.UserId).UserToken).Result;
|
||||
return _api.GetUserSettings(SimklPlugin.Instance.Configuration.GetByGuid(request.UserId).UserToken).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user