Libation 4.0 prep: incrementally incorporate jsonpath (1) all AccountsSettings.json access must use centralized jsonpath. For now == null

This commit is contained in:
Robert McRackan 2020-08-11 14:19:35 -04:00
parent efa5cefa23
commit f50dab94a4
3 changed files with 20 additions and 8 deletions

View File

@ -1,10 +1,26 @@
using System.IO;
using Newtonsoft.Json;
using System.IO;
namespace FileManager
{
public static class AudibleApiStorage
{
// not customizable. don't move to config
public static string AccountsSettingsFile => Path.Combine(Configuration.Instance.LibationFiles, "AccountsSettings.json");
public static string GetJsonPath(
//string username
////, string locale
)
{
return null;
//var usernameSanitized = JsonConvert.ToString(username);
////var localeSanitized = JsonConvert.ToString(locale);
////return $"$.ApiConnectionSettings[?(@.Username == '{usernameSanitized}' && @.IdentityTokens.Locale == '{localeSanitized}')].IdentityTokens";
//return $"$.ApiConnectionSettings[?(@.Username == '{usernameSanitized}')].IdentityTokens";
}
}
}

View File

@ -15,13 +15,9 @@ namespace InternalUtilities
/// <summary>USE THIS from within Libation. It wraps the call with correct JSONPath</summary>
public static async Task<Api> GetApiAsync(ILoginCallback loginCallback = null)
{
var identityFilePath = AudibleApiStorage.AccountsSettingsFile;
// TODO: get jsonpath from ... somewhere
string jsonPath = null;
Localization.SetLocale(Configuration.Instance.LocaleCountryCode);
return await EzApiCreator.GetApiAsync(identityFilePath, loginCallback, jsonPath);
return await EzApiCreator.GetApiAsync(AudibleApiStorage.AccountsSettingsFile, AudibleApiStorage.GetJsonPath(), loginCallback);
}
private static AsyncRetryPolicy policy { get; }

View File

@ -13,7 +13,7 @@
<!-- <PublishSingleFile>true</PublishSingleFile> -->
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Version>3.1.12.54</Version>
<Version>3.1.12.62</Version>
</PropertyGroup>
<ItemGroup>