Blazor Diffusion

<back to all web services

CreateCreative

Creatives
Requires Authentication
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


// @DataContract
class AuditBase implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var DateTime */
        public DateTime $createdDate=new DateTime(),

        // @DataMember(Order=2)
        // @Required()
        /** @var string */
        public string $createdBy='',

        // @DataMember(Order=3)
        /** @var DateTime */
        public DateTime $modifiedDate=new DateTime(),

        // @DataMember(Order=4)
        // @Required()
        /** @var string */
        public string $modifiedBy='',

        // @DataMember(Order=5)
        /** @var DateTime|null */
        public ?DateTime $deletedDate=null,

        // @DataMember(Order=6)
        /** @var string|null */
        public ?string $deletedBy=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['createdDate'])) $this->createdDate = JsonConverters::from('DateTime', $o['createdDate']);
        if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
        if (isset($o['modifiedDate'])) $this->modifiedDate = JsonConverters::from('DateTime', $o['modifiedDate']);
        if (isset($o['modifiedBy'])) $this->modifiedBy = $o['modifiedBy'];
        if (isset($o['deletedDate'])) $this->deletedDate = JsonConverters::from('DateTime', $o['deletedDate']);
        if (isset($o['deletedBy'])) $this->deletedBy = $o['deletedBy'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->createdDate)) $o['createdDate'] = JsonConverters::to('DateTime', $this->createdDate);
        if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
        if (isset($this->modifiedDate)) $o['modifiedDate'] = JsonConverters::to('DateTime', $this->modifiedDate);
        if (isset($this->modifiedBy)) $o['modifiedBy'] = $this->modifiedBy;
        if (isset($this->deletedDate)) $o['deletedDate'] = JsonConverters::to('DateTime', $this->deletedDate);
        if (isset($this->deletedBy)) $o['deletedBy'] = $this->deletedBy;
        return empty($o) ? new class(){} : $o;
    }
}

class Artist extends AuditBase implements JsonSerializable
{
    /**
     * @param DateTime $createdDate
     * @param string $createdBy
     * @param DateTime $modifiedDate
     * @param string $modifiedBy
     * @param DateTime|null $deletedDate
     * @param string|null $deletedBy
     */
    public function __construct(
        DateTime $createdDate=new DateTime(),
        string $createdBy='',
        DateTime $modifiedDate=new DateTime(),
        string $modifiedBy='',
        ?DateTime $deletedDate=null,
        ?string $deletedBy=null,
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $firstName=null,
        /** @var string */
        public string $lastName='',
        /** @var int|null */
        public ?int $yearDied=null,
        /** @var array<string>|null */
        public ?array $type=null,
        /** @var int */
        public int $score=0,
        /** @var int */
        public int $rank=0
    ) {
        parent::__construct($createdDate,$createdBy,$modifiedDate,$modifiedBy,$deletedDate,$deletedBy);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['firstName'])) $this->firstName = $o['firstName'];
        if (isset($o['lastName'])) $this->lastName = $o['lastName'];
        if (isset($o['yearDied'])) $this->yearDied = $o['yearDied'];
        if (isset($o['type'])) $this->type = JsonConverters::fromArray('string', $o['type']);
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['rank'])) $this->rank = $o['rank'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->firstName)) $o['firstName'] = $this->firstName;
        if (isset($this->lastName)) $o['lastName'] = $this->lastName;
        if (isset($this->yearDied)) $o['yearDied'] = $this->yearDied;
        if (isset($this->type)) $o['type'] = JsonConverters::toArray('string', $this->type);
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->rank)) $o['rank'] = $this->rank;
        return empty($o) ? new class(){} : $o;
    }
}

// @ValidateRequest(Validator="HasRole(`Moderator`)")
class CreativeArtist implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        // @References("typeof(BlazorDiffusion.ServiceModel.Creative)")
        /** @var int */
        public int $creativeId=0,

        // @References("typeof(BlazorDiffusion.ServiceModel.Artist)")
        /** @var int */
        public int $artistId=0,

        /** @var Artist|null */
        public ?Artist $artist=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['creativeId'])) $this->creativeId = $o['creativeId'];
        if (isset($o['artistId'])) $this->artistId = $o['artistId'];
        if (isset($o['artist'])) $this->artist = JsonConverters::from('Artist', $o['artist']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->creativeId)) $o['creativeId'] = $this->creativeId;
        if (isset($this->artistId)) $o['artistId'] = $this->artistId;
        if (isset($this->artist)) $o['artist'] = JsonConverters::to('Artist', $this->artist);
        return empty($o) ? new class(){} : $o;
    }
}

class Modifier extends AuditBase implements JsonSerializable
{
    /**
     * @param DateTime $createdDate
     * @param string $createdBy
     * @param DateTime $modifiedDate
     * @param string $modifiedBy
     * @param DateTime|null $deletedDate
     * @param string|null $deletedBy
     */
    public function __construct(
        DateTime $createdDate=new DateTime(),
        string $createdBy='',
        DateTime $modifiedDate=new DateTime(),
        string $modifiedBy='',
        ?DateTime $deletedDate=null,
        ?string $deletedBy=null,
        /** @var int */
        public int $id=0,
        /** @var string */
        public string $name='',
        /** @var string */
        public string $category='',
        /** @var string|null */
        public ?string $description=null,
        /** @var int */
        public int $score=0,
        /** @var int */
        public int $rank=0
    ) {
        parent::__construct($createdDate,$createdBy,$modifiedDate,$modifiedBy,$deletedDate,$deletedBy);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['category'])) $this->category = $o['category'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['rank'])) $this->rank = $o['rank'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->category)) $o['category'] = $this->category;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->rank)) $o['rank'] = $this->rank;
        return empty($o) ? new class(){} : $o;
    }
}

class CreativeModifier implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        // @References("typeof(BlazorDiffusion.ServiceModel.Creative)")
        /** @var int */
        public int $creativeId=0,

        // @References("typeof(BlazorDiffusion.ServiceModel.Modifier)")
        /** @var int */
        public int $modifierId=0,

        /** @var Modifier|null */
        public ?Modifier $modifier=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['creativeId'])) $this->creativeId = $o['creativeId'];
        if (isset($o['modifierId'])) $this->modifierId = $o['modifierId'];
        if (isset($o['modifier'])) $this->modifier = JsonConverters::from('Modifier', $o['modifier']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->creativeId)) $o['creativeId'] = $this->creativeId;
        if (isset($this->modifierId)) $o['modifierId'] = $this->modifierId;
        if (isset($this->modifier)) $o['modifier'] = JsonConverters::to('Modifier', $this->modifier);
        return empty($o) ? new class(){} : $o;
    }
}

class Artifact extends AuditBase implements JsonSerializable
{
    /**
     * @param DateTime $createdDate
     * @param string $createdBy
     * @param DateTime $modifiedDate
     * @param string $modifiedBy
     * @param DateTime|null $deletedDate
     * @param string|null $deletedBy
     */
    public function __construct(
        DateTime $createdDate=new DateTime(),
        string $createdBy='',
        DateTime $modifiedDate=new DateTime(),
        string $modifiedBy='',
        ?DateTime $deletedDate=null,
        ?string $deletedBy=null,
        /** @var int */
        public int $id=0,
        // @References("typeof(BlazorDiffusion.ServiceModel.Creative)")
        /** @var int */
        public int $creativeId=0,

        /** @var string */
        public string $fileName='',
        /** @var string */
        public string $filePath='',
        /** @var string */
        public string $contentType='',
        /** @var int */
        public int $contentLength=0,
        /** @var int */
        public int $width=0,
        /** @var int */
        public int $height=0,
        /** @var int */
        public int $seed=0,
        /** @var string */
        public string $prompt='',
        /** @var bool|null */
        public ?bool $nsfw=null,
        /** @var int|null */
        public ?int $averageHash=null,
        /** @var int|null */
        public ?int $perceptualHash=null,
        /** @var int|null */
        public ?int $differenceHash=null,
        /** @var string|null */
        public ?string $background=null,
        /** @var string|null */
        public ?string $lqip=null,
        /** @var int */
        public int $quality=0,
        /** @var int */
        public int $likesCount=0,
        /** @var int */
        public int $albumsCount=0,
        /** @var int */
        public int $downloadsCount=0,
        /** @var int */
        public int $searchCount=0,
        /** @var int */
        public int $temporalScore=0,
        /** @var int */
        public int $score=0,
        /** @var int */
        public int $rank=0,
        /** @var string */
        public string $refId='',
        /** @var array<string,string>|null */
        public ?array $versions=null
    ) {
        parent::__construct($createdDate,$createdBy,$modifiedDate,$modifiedBy,$deletedDate,$deletedBy);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['creativeId'])) $this->creativeId = $o['creativeId'];
        if (isset($o['fileName'])) $this->fileName = $o['fileName'];
        if (isset($o['filePath'])) $this->filePath = $o['filePath'];
        if (isset($o['contentType'])) $this->contentType = $o['contentType'];
        if (isset($o['contentLength'])) $this->contentLength = $o['contentLength'];
        if (isset($o['width'])) $this->width = $o['width'];
        if (isset($o['height'])) $this->height = $o['height'];
        if (isset($o['seed'])) $this->seed = $o['seed'];
        if (isset($o['prompt'])) $this->prompt = $o['prompt'];
        if (isset($o['nsfw'])) $this->nsfw = $o['nsfw'];
        if (isset($o['averageHash'])) $this->averageHash = $o['averageHash'];
        if (isset($o['perceptualHash'])) $this->perceptualHash = $o['perceptualHash'];
        if (isset($o['differenceHash'])) $this->differenceHash = $o['differenceHash'];
        if (isset($o['background'])) $this->background = $o['background'];
        if (isset($o['lqip'])) $this->lqip = $o['lqip'];
        if (isset($o['quality'])) $this->quality = $o['quality'];
        if (isset($o['likesCount'])) $this->likesCount = $o['likesCount'];
        if (isset($o['albumsCount'])) $this->albumsCount = $o['albumsCount'];
        if (isset($o['downloadsCount'])) $this->downloadsCount = $o['downloadsCount'];
        if (isset($o['searchCount'])) $this->searchCount = $o['searchCount'];
        if (isset($o['temporalScore'])) $this->temporalScore = $o['temporalScore'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['rank'])) $this->rank = $o['rank'];
        if (isset($o['refId'])) $this->refId = $o['refId'];
        if (isset($o['versions'])) $this->versions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['versions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->creativeId)) $o['creativeId'] = $this->creativeId;
        if (isset($this->fileName)) $o['fileName'] = $this->fileName;
        if (isset($this->filePath)) $o['filePath'] = $this->filePath;
        if (isset($this->contentType)) $o['contentType'] = $this->contentType;
        if (isset($this->contentLength)) $o['contentLength'] = $this->contentLength;
        if (isset($this->width)) $o['width'] = $this->width;
        if (isset($this->height)) $o['height'] = $this->height;
        if (isset($this->seed)) $o['seed'] = $this->seed;
        if (isset($this->prompt)) $o['prompt'] = $this->prompt;
        if (isset($this->nsfw)) $o['nsfw'] = $this->nsfw;
        if (isset($this->averageHash)) $o['averageHash'] = $this->averageHash;
        if (isset($this->perceptualHash)) $o['perceptualHash'] = $this->perceptualHash;
        if (isset($this->differenceHash)) $o['differenceHash'] = $this->differenceHash;
        if (isset($this->background)) $o['background'] = $this->background;
        if (isset($this->lqip)) $o['lqip'] = $this->lqip;
        if (isset($this->quality)) $o['quality'] = $this->quality;
        if (isset($this->likesCount)) $o['likesCount'] = $this->likesCount;
        if (isset($this->albumsCount)) $o['albumsCount'] = $this->albumsCount;
        if (isset($this->downloadsCount)) $o['downloadsCount'] = $this->downloadsCount;
        if (isset($this->searchCount)) $o['searchCount'] = $this->searchCount;
        if (isset($this->temporalScore)) $o['temporalScore'] = $this->temporalScore;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->rank)) $o['rank'] = $this->rank;
        if (isset($this->refId)) $o['refId'] = $this->refId;
        if (isset($this->versions)) $o['versions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->versions);
        return empty($o) ? new class(){} : $o;
    }
}

class Creative extends AuditBase implements JsonSerializable
{
    /**
     * @param DateTime $createdDate
     * @param string $createdBy
     * @param DateTime $modifiedDate
     * @param string $modifiedBy
     * @param DateTime|null $deletedDate
     * @param string|null $deletedBy
     */
    public function __construct(
        DateTime $createdDate=new DateTime(),
        string $createdBy='',
        DateTime $modifiedDate=new DateTime(),
        string $modifiedBy='',
        ?DateTime $deletedDate=null,
        ?string $deletedBy=null,
        /** @var int */
        public int $id=0,
        /** @var string */
        public string $userPrompt='',
        /** @var string */
        public string $prompt='',
        /** @var int */
        public int $images=0,
        /** @var int */
        public int $width=0,
        /** @var int */
        public int $height=0,
        /** @var int */
        public int $steps=0,
        /** @var int|null */
        public ?int $curatedArtifactId=null,
        /** @var int|null */
        public ?int $primaryArtifactId=null,
        /** @var array<string>|null */
        public ?array $artistNames=null,
        /** @var array<string>|null */
        public ?array $modifierNames=null,
        /** @var array<CreativeArtist>|null */
        public ?array $artists=null,
        /** @var array<CreativeModifier>|null */
        public ?array $modifiers=null,
        /** @var array<Artifact>|null */
        public ?array $artifacts=null,
        /** @var string|null */
        public ?string $error=null,
        /** @var int|null */
        public ?int $ownerId=null,
        /** @var string|null */
        public ?string $ownerRef=null,
        /** @var string|null */
        public ?string $key=null,
        /** @var bool|null */
        public ?bool $curated=null,
        /** @var int|null */
        public ?int $rating=null,
        /** @var bool|null */
        public ?bool $private=null,
        /** @var int */
        public int $score=0,
        /** @var int */
        public int $rank=0,
        /** @var string */
        public string $refId='',
        /** @var string */
        public string $requestId='',
        /** @var string */
        public string $engineId=''
    ) {
        parent::__construct($createdDate,$createdBy,$modifiedDate,$modifiedBy,$deletedDate,$deletedBy);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['userPrompt'])) $this->userPrompt = $o['userPrompt'];
        if (isset($o['prompt'])) $this->prompt = $o['prompt'];
        if (isset($o['images'])) $this->images = $o['images'];
        if (isset($o['width'])) $this->width = $o['width'];
        if (isset($o['height'])) $this->height = $o['height'];
        if (isset($o['steps'])) $this->steps = $o['steps'];
        if (isset($o['curatedArtifactId'])) $this->curatedArtifactId = $o['curatedArtifactId'];
        if (isset($o['primaryArtifactId'])) $this->primaryArtifactId = $o['primaryArtifactId'];
        if (isset($o['artistNames'])) $this->artistNames = JsonConverters::fromArray('string', $o['artistNames']);
        if (isset($o['modifierNames'])) $this->modifierNames = JsonConverters::fromArray('string', $o['modifierNames']);
        if (isset($o['artists'])) $this->artists = JsonConverters::fromArray('CreativeArtist', $o['artists']);
        if (isset($o['modifiers'])) $this->modifiers = JsonConverters::fromArray('CreativeModifier', $o['modifiers']);
        if (isset($o['artifacts'])) $this->artifacts = JsonConverters::fromArray('Artifact', $o['artifacts']);
        if (isset($o['error'])) $this->error = $o['error'];
        if (isset($o['ownerId'])) $this->ownerId = $o['ownerId'];
        if (isset($o['ownerRef'])) $this->ownerRef = $o['ownerRef'];
        if (isset($o['key'])) $this->key = $o['key'];
        if (isset($o['curated'])) $this->curated = $o['curated'];
        if (isset($o['rating'])) $this->rating = $o['rating'];
        if (isset($o['private'])) $this->private = $o['private'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['rank'])) $this->rank = $o['rank'];
        if (isset($o['refId'])) $this->refId = $o['refId'];
        if (isset($o['requestId'])) $this->requestId = $o['requestId'];
        if (isset($o['engineId'])) $this->engineId = $o['engineId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->userPrompt)) $o['userPrompt'] = $this->userPrompt;
        if (isset($this->prompt)) $o['prompt'] = $this->prompt;
        if (isset($this->images)) $o['images'] = $this->images;
        if (isset($this->width)) $o['width'] = $this->width;
        if (isset($this->height)) $o['height'] = $this->height;
        if (isset($this->steps)) $o['steps'] = $this->steps;
        if (isset($this->curatedArtifactId)) $o['curatedArtifactId'] = $this->curatedArtifactId;
        if (isset($this->primaryArtifactId)) $o['primaryArtifactId'] = $this->primaryArtifactId;
        if (isset($this->artistNames)) $o['artistNames'] = JsonConverters::toArray('string', $this->artistNames);
        if (isset($this->modifierNames)) $o['modifierNames'] = JsonConverters::toArray('string', $this->modifierNames);
        if (isset($this->artists)) $o['artists'] = JsonConverters::toArray('CreativeArtist', $this->artists);
        if (isset($this->modifiers)) $o['modifiers'] = JsonConverters::toArray('CreativeModifier', $this->modifiers);
        if (isset($this->artifacts)) $o['artifacts'] = JsonConverters::toArray('Artifact', $this->artifacts);
        if (isset($this->error)) $o['error'] = $this->error;
        if (isset($this->ownerId)) $o['ownerId'] = $this->ownerId;
        if (isset($this->ownerRef)) $o['ownerRef'] = $this->ownerRef;
        if (isset($this->key)) $o['key'] = $this->key;
        if (isset($this->curated)) $o['curated'] = $this->curated;
        if (isset($this->rating)) $o['rating'] = $this->rating;
        if (isset($this->private)) $o['private'] = $this->private;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->rank)) $o['rank'] = $this->rank;
        if (isset($this->refId)) $o['refId'] = $this->refId;
        if (isset($this->requestId)) $o['requestId'] = $this->requestId;
        if (isset($this->engineId)) $o['engineId'] = $this->engineId;
        return empty($o) ? new class(){} : $o;
    }
}

class CreateCreativeResponse implements JsonSerializable
{
    public function __construct(
        /** @var Creative|null */
        public ?Creative $result=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['result'])) $this->result = JsonConverters::from('Creative', $o['result']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->result)) $o['result'] = JsonConverters::to('Creative', $this->result);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @ValidateRequest(Validator="IsAuthenticated")
/**
 * @template ICreateDb of Creative
 */
class CreateCreative implements ICreateDb, JsonSerializable
{
    public function __construct(
        // @Required()
        /** @var string */
        public string $userPrompt='',

        /** @var int|null */
        public ?int $images=null,
        /** @var int|null */
        public ?int $width=null,
        /** @var int|null */
        public ?int $height=null,
        /** @var int|null */
        public ?int $steps=null,
        /** @var int|null */
        public ?int $seed=null,
        /** @var string|null */
        public ?string $engineId=null,
        /** @var array<int>|null */
        public ?array $artistIds=null,
        /** @var array<int>|null */
        public ?array $modifierIds=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['userPrompt'])) $this->userPrompt = $o['userPrompt'];
        if (isset($o['images'])) $this->images = $o['images'];
        if (isset($o['width'])) $this->width = $o['width'];
        if (isset($o['height'])) $this->height = $o['height'];
        if (isset($o['steps'])) $this->steps = $o['steps'];
        if (isset($o['seed'])) $this->seed = $o['seed'];
        if (isset($o['engineId'])) $this->engineId = $o['engineId'];
        if (isset($o['artistIds'])) $this->artistIds = JsonConverters::fromArray('int', $o['artistIds']);
        if (isset($o['modifierIds'])) $this->modifierIds = JsonConverters::fromArray('int', $o['modifierIds']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->userPrompt)) $o['userPrompt'] = $this->userPrompt;
        if (isset($this->images)) $o['images'] = $this->images;
        if (isset($this->width)) $o['width'] = $this->width;
        if (isset($this->height)) $o['height'] = $this->height;
        if (isset($this->steps)) $o['steps'] = $this->steps;
        if (isset($this->seed)) $o['seed'] = $this->seed;
        if (isset($this->engineId)) $o['engineId'] = $this->engineId;
        if (isset($this->artistIds)) $o['artistIds'] = JsonConverters::toArray('int', $this->artistIds);
        if (isset($this->modifierIds)) $o['modifierIds'] = JsonConverters::toArray('int', $this->modifierIds);
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateCreative DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /xml/reply/CreateCreative HTTP/1.1 
Host: blazordiffusion.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateCreative xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
  <ArtistIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </ArtistIds>
  <EngineId>String</EngineId>
  <Height>0</Height>
  <Images>0</Images>
  <ModifierIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </ModifierIds>
  <Seed>0</Seed>
  <Steps>0</Steps>
  <UserPrompt>String</UserPrompt>
  <Width>0</Width>
</CreateCreative>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CreateCreativeResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <Result>
    <CreatedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</CreatedDate>
    <CreatedBy xmlns="http://schemas.servicestack.net/types">String</CreatedBy>
    <ModifiedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</ModifiedDate>
    <ModifiedBy xmlns="http://schemas.servicestack.net/types">String</ModifiedBy>
    <DeletedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</DeletedDate>
    <DeletedBy xmlns="http://schemas.servicestack.net/types">String</DeletedBy>
    <Artifacts>
      <Artifact>
        <CreatedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</CreatedDate>
        <CreatedBy xmlns="http://schemas.servicestack.net/types">String</CreatedBy>
        <ModifiedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</ModifiedDate>
        <ModifiedBy xmlns="http://schemas.servicestack.net/types">String</ModifiedBy>
        <DeletedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</DeletedDate>
        <DeletedBy xmlns="http://schemas.servicestack.net/types">String</DeletedBy>
        <AlbumsCount>0</AlbumsCount>
        <AverageHash>0</AverageHash>
        <Background>String</Background>
        <ContentLength>0</ContentLength>
        <ContentType>String</ContentType>
        <CreativeId>0</CreativeId>
        <DifferenceHash>0</DifferenceHash>
        <DownloadsCount>0</DownloadsCount>
        <FileName>String</FileName>
        <FilePath>String</FilePath>
        <Height>0</Height>
        <Id>0</Id>
        <LikesCount>0</LikesCount>
        <Lqip>String</Lqip>
        <Nsfw>false</Nsfw>
        <PerceptualHash>0</PerceptualHash>
        <Prompt>String</Prompt>
        <Quality>0</Quality>
        <Rank>0</Rank>
        <RefId>String</RefId>
        <Score>0</Score>
        <SearchCount>0</SearchCount>
        <Seed>0</Seed>
        <TemporalScore>0</TemporalScore>
        <Versions xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Versions>
        <Width>0</Width>
      </Artifact>
    </Artifacts>
    <ArtistNames xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </ArtistNames>
    <Artists>
      <CreativeArtist>
        <Artist>
          <CreatedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</CreatedDate>
          <CreatedBy xmlns="http://schemas.servicestack.net/types">String</CreatedBy>
          <ModifiedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</ModifiedDate>
          <ModifiedBy xmlns="http://schemas.servicestack.net/types">String</ModifiedBy>
          <DeletedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</DeletedDate>
          <DeletedBy xmlns="http://schemas.servicestack.net/types">String</DeletedBy>
          <FirstName>String</FirstName>
          <Id>0</Id>
          <LastName>String</LastName>
          <Rank>0</Rank>
          <Score>0</Score>
          <Type xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <d6p1:string>String</d6p1:string>
          </Type>
          <YearDied>0</YearDied>
        </Artist>
        <ArtistId>0</ArtistId>
        <CreativeId>0</CreativeId>
        <Id>0</Id>
      </CreativeArtist>
    </Artists>
    <Curated>false</Curated>
    <CuratedArtifactId>0</CuratedArtifactId>
    <EngineId>String</EngineId>
    <Error>String</Error>
    <Height>0</Height>
    <Id>0</Id>
    <Images>0</Images>
    <Key>String</Key>
    <ModifierNames xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </ModifierNames>
    <Modifiers>
      <CreativeModifier>
        <CreativeId>0</CreativeId>
        <Id>0</Id>
        <Modifier>
          <CreatedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</CreatedDate>
          <CreatedBy xmlns="http://schemas.servicestack.net/types">String</CreatedBy>
          <ModifiedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</ModifiedDate>
          <ModifiedBy xmlns="http://schemas.servicestack.net/types">String</ModifiedBy>
          <DeletedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</DeletedDate>
          <DeletedBy xmlns="http://schemas.servicestack.net/types">String</DeletedBy>
          <Category>String</Category>
          <Description>String</Description>
          <Id>0</Id>
          <Name>String</Name>
          <Rank>0</Rank>
          <Score>0</Score>
        </Modifier>
        <ModifierId>0</ModifierId>
      </CreativeModifier>
    </Modifiers>
    <OwnerId>0</OwnerId>
    <OwnerRef>String</OwnerRef>
    <PrimaryArtifactId>0</PrimaryArtifactId>
    <Private>false</Private>
    <Prompt>String</Prompt>
    <Rank>0</Rank>
    <Rating>0</Rating>
    <RefId>String</RefId>
    <RequestId>String</RequestId>
    <Score>0</Score>
    <Steps>0</Steps>
    <UserPrompt>String</UserPrompt>
    <Width>0</Width>
  </Result>
</CreateCreativeResponse>