2024-07-11 02:28:24 +02:00
|
|
|
#nullable enable
|
2024-05-09 02:18:02 +02:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace BTCPayServer
|
|
|
|
{
|
|
|
|
public record UnresolvedUri
|
|
|
|
{
|
|
|
|
public static UnresolvedUri Create(string str)
|
|
|
|
{
|
|
|
|
ArgumentNullException.ThrowIfNull(str);
|
|
|
|
if (str.StartsWith("fileid:", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return new FileIdUri(str.Substring("fileid:".Length));
|
|
|
|
}
|
|
|
|
return new Raw(str);
|
|
|
|
}
|
|
|
|
public record FileIdUri(string FileId) : UnresolvedUri
|
|
|
|
{
|
|
|
|
public override string ToString() => $"fileid:{FileId}";
|
|
|
|
}
|
|
|
|
public record Raw(string Uri) : UnresolvedUri
|
|
|
|
{
|
|
|
|
public override string ToString() => Uri;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|