Methods

setClient()

setClient(\GuzzleHttp\ClientInterface  $client) : void

Set the Guzzle client.

Parameters

\GuzzleHttp\ClientInterface $client

getClient()

getClient() : \GuzzleHttp\ClientInterface

Get the client.

Returns

\GuzzleHttp\ClientInterface

setOptions()

setOptions(\Osiset\BasicShopifyAPI\Options  $options) : void

Set the options.

Parameters

\Osiset\BasicShopifyAPI\Options $options

getOptions()

getOptions() : \Osiset\BasicShopifyAPI\Options

Get the options.

Returns

\Osiset\BasicShopifyAPI\Options

request()

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

Runs a request to the Shopify API.

Parameters

string $type

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

string $path

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

array|null $params

Optional parameters to send with the request.

array $headers

Optional headers to append to the request.

boolean $sync

Optionally wait for the request to finish.

Throws

\Exception

Returns

array|\GuzzleHttp\Promise\Promise

requestAccess()

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

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

Parameters

string $code

The code from Shopify.

Throws

\Exception

When API secret is missing.

Returns

\Osiset\BasicShopifyAPI\ResponseAccess

getBaseUri()

getBaseUri() : \GuzzleHttp\Psr7\Uri

Returns the base URI to use.

Throws

\Exception

For missing shop domain.

Returns

\GuzzleHttp\Psr7\Uri

getAuthUrl()

getAuthUrl(string|array  $scopes, string  $redirectUri, string|null  $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.

string $redirectUri

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

string|null $mode

The API access mode, offline or per-user.

Throws

\Exception

For missing API key.

Returns

string —

Formatted URL.