Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
946 B

using System.Text.Json.Serialization;
using System.Web;
using StabilityMatrix.Core.Models.FileInterfaces;
namespace StabilityMatrix.Core.Models.Api.Comfy;
public class ComfyImage
{
[JsonPropertyName("filename")]
public required string FileName { get; set; }
[JsonPropertyName("subfolder")]
public required string SubFolder { get; set; }
[JsonPropertyName("type")]
public required string Type { get; set; }
public Uri ToUri(Uri baseAddress)
{
var query = HttpUtility.ParseQueryString(string.Empty);
query["filename"] = FileName;
query["subfolder"] = SubFolder;
query["type"] = Type;
return new UriBuilder(baseAddress)
{
Path = "/view",
Query = query.ToString()
}.Uri;
}
public FilePath ToFilePath(DirectoryPath outputDir)
{
return new FilePath(outputDir, SubFolder, FileName);
}
}