Blazor Diffusion

<back to all web services

GetAlbumRefs

Albums
<?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 AlbumRef implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $refId='',
        /** @var int */
        public int $ownerId=0,
        /** @var string */
        public string $name='',
        /** @var string */
        public string $slug='',
        /** @var string */
        public string $description='',
        /** @var array<string>|null */
        public ?array $tags=null,
        /** @var string|null */
        public ?string $primaryArtifactRef=null,
        /** @var int */
        public int $artifactsCount=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['refId'])) $this->refId = $o['refId'];
        if (isset($o['ownerId'])) $this->ownerId = $o['ownerId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['slug'])) $this->slug = $o['slug'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['tags'])) $this->tags = JsonConverters::fromArray('string', $o['tags']);
        if (isset($o['primaryArtifactRef'])) $this->primaryArtifactRef = $o['primaryArtifactRef'];
        if (isset($o['artifactsCount'])) $this->artifactsCount = $o['artifactsCount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->refId)) $o['refId'] = $this->refId;
        if (isset($this->ownerId)) $o['ownerId'] = $this->ownerId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->slug)) $o['slug'] = $this->slug;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->tags)) $o['tags'] = JsonConverters::toArray('string', $this->tags);
        if (isset($this->primaryArtifactRef)) $o['primaryArtifactRef'] = $this->primaryArtifactRef;
        if (isset($this->artifactsCount)) $o['artifactsCount'] = $this->artifactsCount;
        return empty($o) ? new class(){} : $o;
    }
}

class GetAlbumRefsResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<AlbumRef>|null */
        public ?array $results=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['results'])) $this->results = JsonConverters::fromArray('AlbumRef', $o['results']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->results)) $o['results'] = JsonConverters::toArray('AlbumRef', $this->results);
        return empty($o) ? new class(){} : $o;
    }
}

class GetAlbumRefs implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetAlbumRefs DTOs

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

HTTP + JSV

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

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

{
	
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	results: 
	[
		{
			refId: String,
			ownerId: 0,
			name: String,
			slug: String,
			description: String,
			tags: 
			[
				String
			],
			primaryArtifactRef: String,
			artifactsCount: 0
		}
	]
}