class RestClient extends AbstractRestClient (View source)

Standard RestClient working with a Guzzle client

Traits

LoggerAwareTrait

Properties

protected bool $disableMappingExceptions from AbstractRestClient
protected bool $enableProfiling from AbstractRestClient
protected mixed $profilingInfo from AbstractRestClient
protected bool $condense from AbstractRestClient
protected string $basePath from AbstractRestClient
protected string $scheme from AbstractRestClient
protected string $host from AbstractRestClient
protected int $port from AbstractRestClient
protected array $defaultParameters from AbstractRestClient
protected array $defaultHeaders from AbstractRestClient
protected RequestInterface $lastRequest from AbstractRestClient
protected ResponseInterface $lastResponse from AbstractRestClient
protected Client $client

Methods

__construct(Client $client, array $parameters = [], array $headers = [], array $options = [])

No description

array
getDefaultParameters()

No description

setDefaultParameters(array $defaultParameters)

No description

array
getDefaultHeaders()

No description

setDefaultHeaders(array $defaultHeaders)

No description

$this
setValues(array $options = [])

No description

$this
setValue($key, $value)

No description

$this
setDisableMappingExceptions($disableMappingExceptions)

No description

bool
getDisableMappingExceptions()

No description

$this
setCondense($condense)

No description

bool
getCondense()

No description

$this
setEnableProfiling($enableProfiling)

No description

bool
getEnableProfiling()

No description

mixed
getProfilingInfo()

No description

string
getBasePath()

No description

setBasePath(string $basePath)

No description

$this
setApiKey($apikey)

No description

string|null
getApiKey()

No description

string
getScheme()

No description

setScheme(string $scheme)

No description

string
getHost()

No description

setHost(string $host)

No description

int
getPort()

No description

setPort(int $port)

No description

ResponseInterface
getResponse(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null)

No description

object
getJsonResponse(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, int $expectedStatus = 200)

Get response as decoded JSON object

object
parseJsonResponse(RequestInterface $request, ResponseInterface $response, int $expectedStatus = 200)

No description

array
prepareParameters(array $parameters = [])

No description

array
prepareHeaders(array $headers = [])

No description

array
buildRestParameters(array $parameters = [], string|null $condition = null, string|null $order = null, string|null $orderKey = null, int|null $offset = null, int|null $limit = null, string|null $groupBy = null, string|null $objectClass = null)

Add REST parameters

Object[]
getObjectList(null $condition = null, null $order = null, null $orderKey = null, null $offset = null, null $limit = null, null $groupBy = null, bool $decode = true, null $objectClass = null)

No description

Asset[]
getAssetList(null $condition = null, null $order = null, null $orderKey = null, null $offset = null, null $limit = null, null $groupBy = null, bool $decode = true)

No description

getDocumentList(null $condition = null, null $order = null, null $orderKey = null, null $offset = null, null $limit = null, null $groupBy = null, bool $decode = true)

No description

mixed|Folder
getObjectById($id, bool $decode = true, null $idMapper = null)

No description

mixed
getDocumentById($id, bool $decode = true, null $idMapper = null)

No description

mixed|Folder
getAssetById($id, bool $decode = true, null $idMapper = null, bool $light = false, null $thumbnail = null, bool $tolerant = false, string $protocol = 'http://')

TODO

mixed
createDocument(Document $document)

Creates a new document.

mixed
createObjectConcrete(AbstractObject $object)

Creates a new object.

mixed|null|string
createAsset(Asset $asset)

No description

mixed
deleteObject($objectId)

Deletes an object.

mixed
deleteAsset($assetId)

Deletes an asset.

mixed
deleteDocument($documentId)

Deletes a document.

mixed
createObjectFolder(Folder $objectFolder)

Creates a new object folder.

mixed
createDocumentFolder(Folder $documentFolder)

Creates a new document folder.

mixed
createAssetFolder(Folder $assetFolder)

Creates a new asset folder.

mixed|null|ClassDefinition|string
getClassById($id, bool $decode = true)

No description

getObjectMetaById($id, bool $decode = true)

No description

mixed
getAssetCount(null $condition = null, null $groupBy = null)

No description

mixed
getDocumentCount(null $condition = null, null $groupBy = null)

No description

mixed
getObjectCount(null $condition = null, null $groupBy = null, null $objectClass = null)

No description

mixed
getUser()

Returns the current user

mixed|null|string
getFieldCollections()

No description

mixed|null|string
getFieldCollection($id)

No description

mixed
getClasses()

Returns a list of defined classes

mixed
getObjectBricks()

Returns a list of defined object bricks

mixed
getObjectBrick($id)

Returns the given object brick definition

mixed
getCurrentTime()

Returns the current server time

mixed
getImageThumbnails()

Returns a list of image thumbnail configurations.

mixed
getImageThumbnail($id)

Returns the image thumbnail configuration with the given ID.

mixed
getServerInfo()

Returns: server-info including pimcore version, current time and extension data.

Client
getClient()

No description

Uri
prepareUri(Uri|string $uri)

No description

Details

__construct(Client $client, array $parameters = [], array $headers = [], array $options = [])

Parameters

Client $client
array $parameters
array $headers
array $options

array getDefaultParameters()

Return Value

array

setDefaultParameters(array $defaultParameters)

Parameters

array $defaultParameters

array getDefaultHeaders()

Return Value

array

setDefaultHeaders(array $defaultHeaders)

Parameters

array $defaultHeaders

$this setValues(array $options = [])

Parameters

array $options

Return Value

$this

$this setValue($key, $value)

Parameters

$key
$value

Return Value

$this

$this setDisableMappingExceptions($disableMappingExceptions)

Parameters

$disableMappingExceptions

Return Value

$this

bool getDisableMappingExceptions()

Return Value

bool

$this setCondense($condense)

Parameters

$condense

Return Value

$this

bool getCondense()

Return Value

bool

$this setEnableProfiling($enableProfiling)

Parameters

$enableProfiling

Return Value

$this

bool getEnableProfiling()

Return Value

bool

mixed getProfilingInfo()

Return Value

mixed

string getBasePath()

Return Value

string

setBasePath(string $basePath)

Parameters

string $basePath

$this setApiKey($apikey)

Parameters

$apikey

Return Value

$this

string|null getApiKey()

Return Value

string|null

string getScheme()

Return Value

string

setScheme(string $scheme)

Parameters

string $scheme

string getHost()

Return Value

string

setHost(string $host)

Parameters

string $host

int getPort()

Return Value

int

setPort(int $port)

Parameters

int $port

ResponseInterface getResponse(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null)

Parameters

string $method The request method
string $uri The URI to fetch
array $parameters The Request parameters
array $files The files
array $server The server parameters (HTTP headers are referenced with a HTTP_ prefix as PHP does)
string $content The raw body data

Return Value

ResponseInterface

object getJsonResponse(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, int $expectedStatus = 200)

Get response as decoded JSON object

Parameters

string $method The request method
string $uri The URI to fetch
array $parameters The Request parameters
array $files The files
array $server The server parameters (HTTP headers are referenced with a HTTP_ prefix as PHP does)
string $content The raw body data
int $expectedStatus The expected status code

Return Value

object

protected object parseJsonResponse(RequestInterface $request, ResponseInterface $response, int $expectedStatus = 200)

Parameters

RequestInterface $request
ResponseInterface $response
int $expectedStatus

Return Value

object

Exceptions

Exception

protected array prepareParameters(array $parameters = [])

Parameters

array $parameters

Return Value

array

protected array prepareHeaders(array $headers = [])

Parameters

array $headers

Return Value

array

protected array buildRestParameters(array $parameters = [], string|null $condition = null, string|null $order = null, string|null $orderKey = null, int|null $offset = null, int|null $limit = null, string|null $groupBy = null, string|null $objectClass = null)

Add REST parameters

Parameters

array $parameters
string|null $condition
string|null $order
string|null $orderKey
int|null $offset
int|null $limit
string|null $groupBy
string|null $objectClass

Return Value

array

Object[] getObjectList(null $condition = null, null $order = null, null $orderKey = null, null $offset = null, null $limit = null, null $groupBy = null, bool $decode = true, null $objectClass = null)

Parameters

null $condition
null $order
null $orderKey
null $offset
null $limit
null $groupBy
bool $decode
null $objectClass

Return Value

Object[]

Exceptions

Exception

Asset[] getAssetList(null $condition = null, null $order = null, null $orderKey = null, null $offset = null, null $limit = null, null $groupBy = null, bool $decode = true)

Parameters

null $condition
null $order
null $orderKey
null $offset
null $limit
null $groupBy
bool $decode

Return Value

Asset[]

Exceptions

Exception

Document[] getDocumentList(null $condition = null, null $order = null, null $orderKey = null, null $offset = null, null $limit = null, null $groupBy = null, bool $decode = true)

Parameters

null $condition
null $order
null $orderKey
null $offset
null $limit
null $groupBy
bool $decode

Return Value

Document[]

Exceptions

Exception

mixed|Folder getObjectById($id, bool $decode = true, null $idMapper = null)

Parameters

$id
bool $decode
null $idMapper

Return Value

mixed|Folder

Exceptions

Exception

mixed getDocumentById($id, bool $decode = true, null $idMapper = null)

Parameters

$id
bool $decode
null $idMapper

Return Value

mixed

Exceptions

Exception

mixed|Folder getAssetById($id, bool $decode = true, null $idMapper = null, bool $light = false, null $thumbnail = null, bool $tolerant = false, string $protocol = 'http://')

TODO

Parameters

$id
bool $decode
null $idMapper
bool $light
null $thumbnail
bool $tolerant
string $protocol

Return Value

mixed|Folder

Exceptions

Exception

mixed createDocument(Document $document)

Creates a new document.

Parameters

Document $document

Return Value

mixed json encoded success value and id

mixed createObjectConcrete(AbstractObject $object)

Creates a new object.

Parameters

AbstractObject $object

Return Value

mixed json encoded success value and id

mixed|null|string createAsset(Asset $asset)

Parameters

Asset $asset

Return Value

mixed|null|string

Exceptions

Exception
Exception

mixed deleteObject($objectId)

Deletes an object.

Parameters

$objectId

Return Value

mixed json encoded success value and id

mixed deleteAsset($assetId)

Deletes an asset.

Parameters

$assetId

Return Value

mixed json encoded success value and id

mixed deleteDocument($documentId)

Deletes a document.

Parameters

$documentId

Return Value

mixed json encoded success value and id

mixed createObjectFolder(Folder $objectFolder)

Creates a new object folder.

Parameters

Folder $objectFolder object folder.

Return Value

mixed

mixed createDocumentFolder(Folder $documentFolder)

Creates a new document folder.

Parameters

Folder $documentFolder document folder.

Return Value

mixed

mixed createAssetFolder(Folder $assetFolder)

Creates a new asset folder.

Parameters

Folder $assetFolder document folder.

Return Value

mixed

mixed|null|ClassDefinition|string getClassById($id, bool $decode = true)

Parameters

$id
bool $decode

Return Value

mixed|null|ClassDefinition|string

Exceptions

Exception

mixed|ClassDefinition getObjectMetaById($id, bool $decode = true)

Parameters

$id
bool $decode

Return Value

mixed|ClassDefinition

Exceptions

Exception

mixed getAssetCount(null $condition = null, null $groupBy = null)

Parameters

null $condition
null $groupBy

Return Value

mixed

Exceptions

Exception

mixed getDocumentCount(null $condition = null, null $groupBy = null)

Parameters

null $condition
null $groupBy

Return Value

mixed

Exceptions

Exception

mixed getObjectCount(null $condition = null, null $groupBy = null, null $objectClass = null)

Parameters

null $condition
null $groupBy
null $objectClass

Return Value

mixed

Exceptions

Exception

mixed getUser()

Returns the current user

Return Value

mixed

mixed|null|string getFieldCollections()

Return Value

mixed|null|string

Exceptions

Exception

mixed|null|string getFieldCollection($id)

Parameters

$id

Return Value

mixed|null|string

Exceptions

Exception

mixed getClasses()

Returns a list of defined classes

Return Value

mixed

mixed getObjectBricks()

Returns a list of defined object bricks

Return Value

mixed

mixed getObjectBrick($id)

Returns the given object brick definition

Parameters

$id

Return Value

mixed

mixed getCurrentTime()

Returns the current server time

Return Value

mixed

mixed getImageThumbnails()

Returns a list of image thumbnail configurations.

Return Value

mixed

mixed getImageThumbnail($id)

Returns the image thumbnail configuration with the given ID.

Parameters

$id

Return Value

mixed

mixed getServerInfo()

Returns: server-info including pimcore version, current time and extension data.

Return Value

mixed

Client getClient()

Return Value

Client

protected Uri prepareUri(Uri|string $uri)

Parameters

Uri|string $uri

Return Value

Uri