Blazor Diffusion

<back to all web services

GetUserInfo

User
<?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 Likes implements JsonSerializable
{
    public function __construct(
        /** @var array<int>|null */
        public ?array $artifactIds=null,
        /** @var array<int>|null */
        public ?array $albumIds=null
    ) {
    }

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

class AlbumResult implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string */
        public string $name='',
        /** @var string */
        public string $slug='',
        /** @var string */
        public string $albumRef='',
        /** @var string */
        public string $ownerRef='',
        /** @var int|null */
        public ?int $primaryArtifactId=null,
        /** @var int */
        public int $score=0,
        /** @var array<int>|null */
        public ?array $artifactIds=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['slug'])) $this->slug = $o['slug'];
        if (isset($o['albumRef'])) $this->albumRef = $o['albumRef'];
        if (isset($o['ownerRef'])) $this->ownerRef = $o['ownerRef'];
        if (isset($o['primaryArtifactId'])) $this->primaryArtifactId = $o['primaryArtifactId'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['artifactIds'])) $this->artifactIds = JsonConverters::fromArray('int', $o['artifactIds']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->slug)) $o['slug'] = $this->slug;
        if (isset($this->albumRef)) $o['albumRef'] = $this->albumRef;
        if (isset($this->ownerRef)) $o['ownerRef'] = $this->ownerRef;
        if (isset($this->primaryArtifactId)) $o['primaryArtifactId'] = $this->primaryArtifactId;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->artifactIds)) $o['artifactIds'] = JsonConverters::toArray('int', $this->artifactIds);
        return empty($o) ? new class(){} : $o;
    }
}

class UserResult implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $refId='',
        /** @var string|null */
        public ?string $handle=null,
        /** @var string|null */
        public ?string $avatar=null,
        /** @var string|null */
        public ?string $profileUrl=null,
        /** @var Likes|null */
        public ?Likes $likes=null,
        /** @var array<AlbumResult>|null */
        public ?array $albums=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['refId'])) $this->refId = $o['refId'];
        if (isset($o['handle'])) $this->handle = $o['handle'];
        if (isset($o['avatar'])) $this->avatar = $o['avatar'];
        if (isset($o['profileUrl'])) $this->profileUrl = $o['profileUrl'];
        if (isset($o['likes'])) $this->likes = JsonConverters::from('Likes', $o['likes']);
        if (isset($o['albums'])) $this->albums = JsonConverters::fromArray('AlbumResult', $o['albums']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->refId)) $o['refId'] = $this->refId;
        if (isset($this->handle)) $o['handle'] = $this->handle;
        if (isset($this->avatar)) $o['avatar'] = $this->avatar;
        if (isset($this->profileUrl)) $o['profileUrl'] = $this->profileUrl;
        if (isset($this->likes)) $o['likes'] = JsonConverters::to('Likes', $this->likes);
        if (isset($this->albums)) $o['albums'] = JsonConverters::toArray('AlbumResult', $this->albums);
        return empty($o) ? new class(){} : $o;
    }
}

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

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['result'])) $this->result = JsonConverters::from('UserResult', $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('UserResult', $this->result);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class GetUserInfo implements IGet, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $refId=''
    ) {
    }

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

PHP GetUserInfo 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/GetUserInfo HTTP/1.1 
Host: blazordiffusion.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<GetUserInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
  <RefId>String</RefId>
</GetUserInfo>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetUserInfoResponse 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>
    <Albums>
      <AlbumResult>
        <AlbumRef>String</AlbumRef>
        <ArtifactIds xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:int>0</d5p1:int>
        </ArtifactIds>
        <Id>0</Id>
        <Name>String</Name>
        <OwnerRef>String</OwnerRef>
        <PrimaryArtifactId>0</PrimaryArtifactId>
        <Score>0</Score>
        <Slug>String</Slug>
      </AlbumResult>
    </Albums>
    <Avatar>String</Avatar>
    <Handle>String</Handle>
    <Likes>
      <AlbumIds xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:int>0</d4p1:int>
      </AlbumIds>
      <ArtifactIds xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:int>0</d4p1:int>
      </ArtifactIds>
    </Likes>
    <ProfileUrl>String</ProfileUrl>
    <RefId>String</RefId>
  </Result>
</GetUserInfoResponse>