mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
f8f98ab7f0
* Allow overrides on all methods * Add non-returning SendHttpRequest methods * Use SendHttpRequest consistently * Use file-scoped namespace * Rates: Set default null value for currencyPair * Ensure it works with instances which have BTCPAY_ROOTPATH set
30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace BTCPayServer.Client;
|
|
|
|
public partial class BTCPayServerClient
|
|
{
|
|
public static Uri GenerateAuthorizeUri(Uri btcpayHost, string[] permissions, bool strict = true,
|
|
bool selectiveStores = false, (string ApplicationIdentifier, Uri Redirect) applicationDetails = default)
|
|
{
|
|
var result = new UriBuilder(btcpayHost) { Path = "api-keys/authorize" };
|
|
AppendPayloadToQuery(result,
|
|
new Dictionary<string, object>
|
|
{
|
|
{"strict", strict}, {"selectiveStores", selectiveStores}, {"permissions", permissions}
|
|
});
|
|
|
|
if (applicationDetails.Redirect != null)
|
|
{
|
|
AppendPayloadToQuery(result, new KeyValuePair<string, object>("redirect", applicationDetails.Redirect));
|
|
if (!string.IsNullOrEmpty(applicationDetails.ApplicationIdentifier))
|
|
{
|
|
AppendPayloadToQuery(result, new KeyValuePair<string, object>("applicationIdentifier", applicationDetails.ApplicationIdentifier));
|
|
}
|
|
}
|
|
|
|
return result.Uri;
|
|
}
|
|
}
|