using System; using System.Collections.Generic; using System.Threading.Tasks; 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); result.Path = "api-keys/authorize"; AppendPayloadToQuery(result, new Dictionary() { {"strict", strict}, {"selectiveStores", selectiveStores}, {"permissions", permissions} }); if (applicationDetails.Redirect != null) { AppendPayloadToQuery(result, new KeyValuePair("redirect", applicationDetails.Redirect)); if (!string.IsNullOrEmpty(applicationDetails.ApplicationIdentifier)) { AppendPayloadToQuery(result, new KeyValuePair("applicationIdentifier", applicationDetails.ApplicationIdentifier)); } } return result.Uri; } } }