iface & doi
This commit is contained in:
parent
1b4f5bf782
commit
4279114543
2 changed files with 22 additions and 1 deletions
|
@ -11,7 +11,14 @@ public readonly struct Doi
|
|||
try
|
||||
{
|
||||
Prefix = short.Parse(match.Groups["prefix"].Value);
|
||||
Suffix = match.Groups["suffix"].Value;
|
||||
if (Prefix > 1000 && Prefix < 10000)
|
||||
{
|
||||
Suffix = match.Groups["suffix"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -19,6 +26,17 @@ public readonly struct Doi
|
|||
}
|
||||
}
|
||||
|
||||
public Doi(short prefix, string suffix)
|
||||
{
|
||||
if (prefix > 1000 && prefix < 10000)
|
||||
{
|
||||
Prefix = prefix;
|
||||
Suffix = suffix;
|
||||
return;
|
||||
}
|
||||
throw new ArgumentException($"Invalid prefix: {prefix}");
|
||||
}
|
||||
|
||||
public short Prefix { get; }
|
||||
public string Suffix { get; }
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
using System.Net;
|
||||
|
||||
namespace Nyanlabs.Pubresolv;
|
||||
|
||||
public interface IResolver
|
||||
{
|
||||
public Task Resolve(Doi doi);
|
||||
public Task<bool> Authenticate(ICredentials credentials);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue