show all plugins regardless of version (#4717)

This commit is contained in:
Andrew Camilleri
2023-02-28 12:16:33 +01:00
committed by GitHub
parent 808949a884
commit 21091cbf1a
2 changed files with 6 additions and 3 deletions

View File

@@ -55,10 +55,13 @@ namespace BTCPayServer.Plugins
{
this.httpClient = httpClient;
}
static JsonSerializerSettings serializerSettings = new JsonSerializerSettings() { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() };
static JsonSerializerSettings serializerSettings = new() { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() };
public async Task<PublishedVersion[]> GetPublishedVersions(string btcpayVersion, bool includePreRelease)
{
var result = await httpClient.GetStringAsync($"api/v1/plugins?btcpayVersion={btcpayVersion}&includePreRelease={includePreRelease}");
var queryString = $"?includePreRelease={includePreRelease}";
if(btcpayVersion is not null)
queryString += $"&btcpayVersion={btcpayVersion}&";
var result = await httpClient.GetStringAsync($"api/v1/plugins{queryString}");
return JsonConvert.DeserializeObject<PublishedVersion[]>(result, serializerSettings) ?? throw new InvalidOperationException();
}
}