ClientInterface

interface DreamCommerce\ShopAppstoreLib\ClientInterface

Interface specifying methods for client modules.

methods

DreamCommerce\ShopAppstoreLib\ClientInterface::authenticate($force = false)

Performs authentication based on AuthCode set earlier.

Parameters:
  • $force (boolean) – force getting tokens ignoring already set
Return type:

stdClass

Returns:

tokens

A sample structure may look like:

array(
    'access_token'=>'xxxxxx',
    'expires_in'=>'3600',
    'token_type'=>'bearer'
)
DreamCommerce\ShopAppstoreLib\ClientInterface::request(Resource $res, $method, $objectPath = null, $data =, []$query =[])

Performs REST request

Parameters:
  • $res (Resource) – resource to perform request against
  • $method (string) – HTTP method name
  • $objectPath (null|array|integer) – URL path of resource
  • $data (array) – payload
  • $query (array) – query string
Return type:

mixed

DreamCommerce\ShopAppstoreLib\ClientInterface::setHttpClient(HttpInterface $httpClient)

Set HttpClient for client.

Parameters:
  • $httpClient (HttpInterface) – client
DreamCommerce\ShopAppstoreLib\ClientInterface::getHttpClient()

Get HttpClient.

Return type:HttpInterface|null
DreamCommerce\ShopAppstoreLib\ClientInterface::getLocale()

Get current locale.

DreamCommerce\ShopAppstoreLib\ClientInterface::setLocale($locale)

Set messages language based on $locale.

Parameters:
  • $locale (string) – locale to set
DreamCommerce\ShopAppstoreLib\ClientInterface::getLogger()

Get bound LoggerInterface` instance.

Return type:LoggerInterface|null
DreamCommerce\ShopAppstoreLib\ClientInterface::setLogger(LoggerInterface $logger)

Set LoggerInterface` for this client.

Parameters:
  • $logger (LoggerInterface) – instance
DreamCommerce\ShopAppstoreLib\ClientInterface::setOnTokenInvalidHandler($callback = null)

Set handler called upon invalid token exception detected.

Parameters:
  • $callback (Callable|null) – callback