<back to all web services

FilesGetRequest

The following routes are available for this service:
GET/RestApi/files-api
<?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 FilesGetRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Path=null,
        /** @var string|null */
        public ?string $Extension=null,
        /** @var int */
        public int $Skip=0,
        /** @var int */
        public int $Take=0
    ) {
    }

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

class FilesItemViewModel implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var bool|null */
        public ?bool $IsFolder=null,
        /** @var bool|null */
        public ?bool $HasChildren=null
    ) {
    }

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

class FilesViewModel implements JsonSerializable
{
    public function __construct(
        /** @var array<FilesItemViewModel>|null */
        public ?array $Items=null,
        /** @var string|null */
        public ?string $Error=null
    ) {
    }

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

PHP FilesGetRequest DTOs

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

HTTP + OTHER

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

GET /RestApi/files-api HTTP/1.1 
Host: www.asg.com.au 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Error":"String"}