now , many API return a wrapper
public record PixivResponse<T>(
bool Error,
string? Message,
T Body)
{
public T Body { get => Error ? throw new PixivException(Message) : field; init; } = Body;
public void ThrowIfError()
{
if (Error)
{
throw new PixivException(Message);
}
}
}
now, we must to
public interface IPixivClient
{
[Get("user/{id}")]
Task<PixivResponse<UserInfo>> GetUser(string id);
}
If there is a way to automatically parse the T Body, it would be very convenient.
now , many API return a wrapper
now, we must to
If there is a way to automatically parse the T Body, it would be very convenient.