Documentation

GraphQL
in package

Class for Making, and Authenticating GraphQL requests

Table of Contents

Properties

$client  : Client|null
$jwtToken  : string|null
$userName  : string|null

Methods

__construct()  : mixed
GraphQL constructor takes an optional script id.
MakeRequest()  : mixed
Handles the query and returns back a json response.
askForJwtToken()  : string|null
Handles the creation and set of the JWT Token.

Properties

$client

protected Client|null $client = null

$jwtToken

protected string|null $jwtToken = null

$userName

protected string|null $userName = null

Methods

__construct()

GraphQL constructor takes an optional script id.

public __construct([string|int|null $scriptId = null ]) : mixed

There are three use cases:

  1. we are calling this class from headless script, we set the username to the script name e.g. "script_test"
  2. we are calling this class from browser script, we set the username to the logged-in username and script name e.g. "jdoe.script_test"
  3. we are calling this class without a script, we set the username to just the logged-in username
Parameters
$scriptId : string|int|null = null
  • Optional script id.
Tags
throws
GuzzleException

MakeRequest()

Handles the query and returns back a json response.

public MakeRequest(mixed $query) : mixed
Parameters
$query : mixed
  • The data that we want to fetch.
Tags
throws
GuzzleException

askForJwtToken()

Handles the creation and set of the JWT Token.

private askForJwtToken(JTable $table) : string|null
Parameters
$table : JTable
  • JTable object.
Tags
throws
GuzzleException
Return values
string|null

        
On this page

Search results