Blazor Diffusion

<back to all web services

QueueCreative

<?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};


class QueueCreative implements 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 QueueCreative DTOs

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

HTTP + CSV

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

POST /csv/reply/QueueCreative HTTP/1.1 
Host: blazordiffusion.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"userPrompt":"String","images":0,"width":0,"height":0,"steps":0,"seed":0,"engineId":"String","artistIds":[0],"modifierIds":[0]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{}