mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
26 lines
704 B
C#
26 lines
704 B
C#
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|