<?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 QueryBase implements JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var int|null */
public ?int $skip=null,
// @DataMember(Order=2)
/** @var int|null */
public ?int $take=null,
// @DataMember(Order=3)
/** @var string|null */
public ?string $orderBy=null,
// @DataMember(Order=4)
/** @var string|null */
public ?string $orderByDesc=null,
// @DataMember(Order=5)
/** @var string|null */
public ?string $include=null,
// @DataMember(Order=6)
/** @var string|null */
public ?string $fields=null,
// @DataMember(Order=7)
/** @var array<string,string>|null */
public ?array $meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['skip'])) $this->skip = $o['skip'];
if (isset($o['take'])) $this->take = $o['take'];
if (isset($o['orderBy'])) $this->orderBy = $o['orderBy'];
if (isset($o['orderByDesc'])) $this->orderByDesc = $o['orderByDesc'];
if (isset($o['include'])) $this->include = $o['include'];
if (isset($o['fields'])) $this->fields = $o['fields'];
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->skip)) $o['skip'] = $this->skip;
if (isset($this->take)) $o['take'] = $this->take;
if (isset($this->orderBy)) $o['orderBy'] = $this->orderBy;
if (isset($this->orderByDesc)) $o['orderByDesc'] = $this->orderByDesc;
if (isset($this->include)) $o['include'] = $this->include;
if (isset($this->fields)) $o['fields'] = $this->fields;
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class QueryDb extends QueryBase implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): QueryDb {
$to = new QueryDb();
$to->genericArgs = $genericArgs;
return $to;
}
/**
* @param int|null $skip
* @param int|null $take
* @param string|null $orderBy
* @param string|null $orderByDesc
* @param string|null $include
* @param string|null $fields
* @param array<string,string>|null $meta
*/
public function __construct(
mixed $skip=null,
mixed $take=null,
mixed $orderBy=null,
mixed $orderByDesc=null,
mixed $include=null,
mixed $fields=null,
mixed $meta=null
) {
parent::__construct($skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
class ArtifactLike implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
// @References("typeof(BlazorDiffusion.ServiceModel.Artifact)")
/** @var int */
public int $artifactId=0,
/** @var int */
public int $appUserId=0,
/** @var DateTime */
public DateTime $createdDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['artifactId'])) $this->artifactId = $o['artifactId'];
if (isset($o['appUserId'])) $this->appUserId = $o['appUserId'];
if (isset($o['createdDate'])) $this->createdDate = JsonConverters::from('DateTime', $o['createdDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->artifactId)) $o['artifactId'] = $this->artifactId;
if (isset($this->appUserId)) $o['appUserId'] = $this->appUserId;
if (isset($this->createdDate)) $o['createdDate'] = JsonConverters::to('DateTime', $this->createdDate);
return empty($o) ? new class(){} : $o;
}
}
// @ValidateRequest(Validator="IsAuthenticated")
/**
* @template QueryDb of ArtifactLike
*/
class QueryArtifactLikes extends QueryDb implements JsonSerializable
{
/**
* @param int|null $skip
* @param int|null $take
* @param string|null $orderBy
* @param string|null $orderByDesc
* @param string|null $include
* @param string|null $fields
* @param array<string,string>|null $meta
*/
public function __construct(
?int $skip=null,
?int $take=null,
?string $orderBy=null,
?string $orderByDesc=null,
?string $include=null,
?string $fields=null,
?array $meta=null
) {
parent::__construct($skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
// @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 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 ArtifactResult extends Artifact implements JsonSerializable
{
/**
* @param DateTime $createdDate
* @param string $createdBy
* @param DateTime $modifiedDate
* @param string $modifiedBy
* @param DateTime|null $deletedDate
* @param string|null $deletedBy
* @param int $id
* @param int $creativeId
* @param string $fileName
* @param string $filePath
* @param string $contentType
* @param int $contentLength
* @param int $width
* @param int $height
* @param int $seed
* @param string $prompt
* @param bool|null $nsfw
* @param int|null $averageHash
* @param int|null $perceptualHash
* @param int|null $differenceHash
* @param string|null $background
* @param string|null $lqip
* @param int $quality
* @param int $likesCount
* @param int $albumsCount
* @param int $downloadsCount
* @param int $searchCount
* @param int $temporalScore
* @param int $score
* @param int $rank
* @param string $refId
* @param array<string,string>|null $versions
*/
public function __construct(
DateTime $createdDate=new DateTime(),
string $createdBy='',
DateTime $modifiedDate=new DateTime(),
string $modifiedBy='',
?DateTime $deletedDate=null,
?string $deletedBy=null,
int $id=0,
int $creativeId=0,
string $fileName='',
string $filePath='',
string $contentType='',
int $contentLength=0,
int $width=0,
int $height=0,
int $seed=0,
string $prompt='',
?bool $nsfw=null,
?int $averageHash=null,
?int $perceptualHash=null,
?int $differenceHash=null,
?string $background=null,
?string $lqip=null,
int $quality=0,
int $likesCount=0,
int $albumsCount=0,
int $downloadsCount=0,
int $searchCount=0,
int $temporalScore=0,
int $score=0,
int $rank=0,
string $refId='',
?array $versions=null,
/** @var string */
public string $userPrompt='',
/** @var array<string>|null */
public ?array $artistNames=null,
/** @var array<string>|null */
public ?array $modifierNames=null,
/** @var int|null */
public ?int $primaryArtifactId=null,
/** @var string */
public string $ownerRef='',
/** @var float|null */
public ?float $similarity=null
) {
parent::__construct($createdDate,$createdBy,$modifiedDate,$modifiedBy,$deletedDate,$deletedBy,$id,$creativeId,$fileName,$filePath,$contentType,$contentLength,$width,$height,$seed,$prompt,$nsfw,$averageHash,$perceptualHash,$differenceHash,$background,$lqip,$quality,$likesCount,$albumsCount,$downloadsCount,$searchCount,$temporalScore,$score,$rank,$refId,$versions);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['userPrompt'])) $this->userPrompt = $o['userPrompt'];
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['primaryArtifactId'])) $this->primaryArtifactId = $o['primaryArtifactId'];
if (isset($o['ownerRef'])) $this->ownerRef = $o['ownerRef'];
if (isset($o['similarity'])) $this->similarity = $o['similarity'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->userPrompt)) $o['userPrompt'] = $this->userPrompt;
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->primaryArtifactId)) $o['primaryArtifactId'] = $this->primaryArtifactId;
if (isset($this->ownerRef)) $o['ownerRef'] = $this->ownerRef;
if (isset($this->similarity)) $o['similarity'] = $this->similarity;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
/**
* @template T
*/
class QueryResponse implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): QueryResponse {
$to = new QueryResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
// @DataMember(Order=1)
/** @var int */
public mixed $offset=0,
// @DataMember(Order=2)
/** @var int */
public mixed $total=0,
// @DataMember(Order=3)
/** @var array<ArtifactResult>|null */
public mixed $results=null,
// @DataMember(Order=4)
/** @var array<string,string>|null */
public mixed $meta=null,
// @DataMember(Order=5)
/** @var ResponseStatus|null */
public mixed $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['offset'])) $this->offset = $o['offset'];
if (isset($o['total'])) $this->total = $o['total'];
if (isset($o['results'])) $this->results = JsonConverters::fromArray('ArtifactResult', $o['results']);
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->offset)) $o['offset'] = $this->offset;
if (isset($this->total)) $o['total'] = $this->total;
if (isset($this->results)) $o['results'] = JsonConverters::toArray('ArtifactResult', $this->results);
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /xml/reply/QueryArtifactLikes HTTP/1.1
Host: blazordiffusion.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<QueryArtifactLikes xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
<Skip xmlns="http://schemas.servicestack.net/types">0</Skip>
<Take xmlns="http://schemas.servicestack.net/types">0</Take>
<OrderBy xmlns="http://schemas.servicestack.net/types">String</OrderBy>
<OrderByDesc xmlns="http://schemas.servicestack.net/types">String</OrderByDesc>
<Include xmlns="http://schemas.servicestack.net/types">String</Include>
<Fields xmlns="http://schemas.servicestack.net/types">String</Fields>
<Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.servicestack.net/types">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</Meta>
</QueryArtifactLikes>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <QueryResponseOfArtifactLike55quYL7_S xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <Offset>0</Offset> <Total>0</Total> <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel"> <d2p1:ArtifactLike> <d2p1:AppUserId>0</d2p1:AppUserId> <d2p1:ArtifactId>0</d2p1:ArtifactId> <d2p1:CreatedDate>0001-01-01T00:00:00</d2p1:CreatedDate> <d2p1:Id>0</d2p1:Id> </d2p1:ArtifactLike> </Results> <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:KeyValueOfstringstring> <d2p1:Key>String</d2p1:Key> <d2p1:Value>String</d2p1:Value> </d2p1:KeyValueOfstringstring> </Meta> <ResponseStatus> <ErrorCode>String</ErrorCode> <Message>String</Message> <StackTrace>String</StackTrace> <Errors> <ResponseError> <ErrorCode>String</ErrorCode> <FieldName>String</FieldName> <Message>String</Message> <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> </Meta> </ResponseError> </Errors> <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> </Meta> </ResponseStatus> </QueryResponseOfArtifactLike55quYL7_S>