mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 01:43:50 +01:00
25ae6df095
* Greenfield: Add file endpoints and upload - Endpoints for server files - File upload using `multipart/form-data` Closes #6074. Can also be tested using cURL: - `curl --location 'https://localhost:14142/api/v1/files' --header 'Authorization: token MY_API_TOKEN' --form 'file=@"LOCAL_FILEPATH"'` - `curl --location 'https://localhost:14142/api/v1/users/me/picture' --header 'Authorization: token MY_API_TOKEN' --form 'file=@"LOCAL_FILEPATH"'` * Revert UnresolvedUri changes * Add upload for store logo
27 lines
721 B
C#
27 lines
721 B
C#
#nullable enable
|
|
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;
|
|
}
|
|
}
|
|
}
|