\Osiset\BasicShopifyAPI\ClientsRest

REST handler.

Summary

Methods
Properties
Constants
requestAccess()
getAuthUrl()
request()
handleSuccess()
handleFailure()
No public properties found
No constants found
extractLinkHeader()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

requestAccess()

requestAccess(\Osiset\BasicShopifyAPI\Clients\string  $code) : \Osiset\BasicShopifyAPI\ResponseAccess

Gets the access object from a "code" supplied by Shopify request after successfull auth (for public apps).

Parameters

\Osiset\BasicShopifyAPI\Clients\string $code

The code from Shopify.

Returns

\Osiset\BasicShopifyAPI\ResponseAccess

getAuthUrl()

getAuthUrl(string|array  $scopes, \Osiset\BasicShopifyAPI\Clients\string  $redirectUri, \Osiset\BasicShopifyAPI\Clients\string  $mode = 'offline') : string

Gets the auth URL for Shopify to allow the user to accept the app (for public apps).

Parameters

string|array $scopes

The API scopes as a comma seperated string or array.

\Osiset\BasicShopifyAPI\Clients\string $redirectUri

The valid redirect URI for after acceptance of the permissions. It must match the redirect_uri in your app settings.

\Osiset\BasicShopifyAPI\Clients\string $mode

The API access mode, offline or per-user.

Returns

string —

Formatted URL.

request()

request(\Osiset\BasicShopifyAPI\Clients\string  $type, \Osiset\BasicShopifyAPI\Clients\string  $path, array  $params = null, array  $headers = array(), \Osiset\BasicShopifyAPI\Clients\bool  $sync = true) : array|\GuzzleHttp\Promise\Promise

Runs a request to the Shopify API.

Parameters

\Osiset\BasicShopifyAPI\Clients\string $type

The type of request... GET, POST, PUT, DELETE.

\Osiset\BasicShopifyAPI\Clients\string $path

The Shopify API path... /admin/xxxx/xxxx.json.

array $params

Optional parameters to send with the request.

array $headers

Optional headers to append to the request.

\Osiset\BasicShopifyAPI\Clients\bool $sync

Optionally wait for the request to finish.

Returns

array|\GuzzleHttp\Promise\Promise

handleSuccess()

handleSuccess(\Psr\Http\Message\ResponseInterface  $resp) : array

Handle success of response.

Parameters

\Psr\Http\Message\ResponseInterface $resp

Returns

array

handleFailure()

handleFailure(\GuzzleHttp\Exception\RequestException  $e) : array

Handle failure of response.

Parameters

\GuzzleHttp\Exception\RequestException $e

Returns

array

extractLinkHeader()

extractLinkHeader(\Osiset\BasicShopifyAPI\Clients\string  $header) : \Osiset\BasicShopifyAPI\ResponseAccess

Processes the "Link" header.

Parameters

\Osiset\BasicShopifyAPI\Clients\string $header

Returns

\Osiset\BasicShopifyAPI\ResponseAccess