<back to all web services

CommentsFilter

The following routes are available for this service:
GET/RestApi/comments-api/comments
<?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 CommentResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Key=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Message=null,
        /** @var DateTime */
        public DateTime $DateCreated=new DateTime(),
        /** @var string|null */
        public ?string $ProfilePictureUrl=null,
        /** @var string|null */
        public ?string $ProfilePictureThumbnailUrl=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var string|null */
        public ?string $ThreadKey=null,
        /** @var string|null */
        public ?string $AuthorIpAddress=null,
        /** @var string|null */
        public ?string $CustomData=null,
        /** @var float|null */
        public ?float $Rating=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Key'])) $this->Key = $o['Key'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Message'])) $this->Message = $o['Message'];
        if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
        if (isset($o['ProfilePictureUrl'])) $this->ProfilePictureUrl = $o['ProfilePictureUrl'];
        if (isset($o['ProfilePictureThumbnailUrl'])) $this->ProfilePictureThumbnailUrl = $o['ProfilePictureThumbnailUrl'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['ThreadKey'])) $this->ThreadKey = $o['ThreadKey'];
        if (isset($o['AuthorIpAddress'])) $this->AuthorIpAddress = $o['AuthorIpAddress'];
        if (isset($o['CustomData'])) $this->CustomData = $o['CustomData'];
        if (isset($o['Rating'])) $this->Rating = $o['Rating'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Key)) $o['Key'] = $this->Key;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Message)) $o['Message'] = $this->Message;
        if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
        if (isset($this->ProfilePictureUrl)) $o['ProfilePictureUrl'] = $this->ProfilePictureUrl;
        if (isset($this->ProfilePictureThumbnailUrl)) $o['ProfilePictureThumbnailUrl'] = $this->ProfilePictureThumbnailUrl;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->ThreadKey)) $o['ThreadKey'] = $this->ThreadKey;
        if (isset($this->AuthorIpAddress)) $o['AuthorIpAddress'] = $this->AuthorIpAddress;
        if (isset($this->CustomData)) $o['CustomData'] = $this->CustomData;
        if (isset($this->Rating)) $o['Rating'] = $this->Rating;
        return empty($o) ? new class(){} : $o;
    }
}

class CommentsFilter implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ThreadKey=null,
        /** @var int */
        public int $Skip=0,
        /** @var int */
        public int $Take=0,
        /** @var bool|null */
        public ?bool $SortDescending=null,
        /** @var DateTime */
        public DateTime $NewerThan=new DateTime(),
        /** @var DateTime */
        public DateTime $OlderThan=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ThreadKey'])) $this->ThreadKey = $o['ThreadKey'];
        if (isset($o['Skip'])) $this->Skip = $o['Skip'];
        if (isset($o['Take'])) $this->Take = $o['Take'];
        if (isset($o['SortDescending'])) $this->SortDescending = $o['SortDescending'];
        if (isset($o['NewerThan'])) $this->NewerThan = JsonConverters::from('DateTime', $o['NewerThan']);
        if (isset($o['OlderThan'])) $this->OlderThan = JsonConverters::from('DateTime', $o['OlderThan']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ThreadKey)) $o['ThreadKey'] = $this->ThreadKey;
        if (isset($this->Skip)) $o['Skip'] = $this->Skip;
        if (isset($this->Take)) $o['Take'] = $this->Take;
        if (isset($this->SortDescending)) $o['SortDescending'] = $this->SortDescending;
        if (isset($this->NewerThan)) $o['NewerThan'] = JsonConverters::to('DateTime', $this->NewerThan);
        if (isset($this->OlderThan)) $o['OlderThan'] = JsonConverters::to('DateTime', $this->OlderThan);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template CommentResponse
 */
class CollectionResponse implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): CollectionResponse {
        $to = new CollectionResponse();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        /** @var int */
        public mixed $TotalCount=0,
        /** @var array<CommentResponse>|null */
        public mixed $Items=null
    ) {
    }

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

PHP CommentsFilter 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.

GET /RestApi/comments-api/comments HTTP/1.1 
Host: www.asg.com.au 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CollectionResponseOfCommentResponseXvaRN2Ag xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Telerik.Sitefinity.Services.Comments.DTO">
  <Items i:nil="true" />
  <TotalCount>0</TotalCount>
</CollectionResponseOfCommentResponseXvaRN2Ag>