GraphQL
in package
Class for Making, and Authenticating GraphQL requests
Table of Contents
Properties
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:
- we are calling this class from headless script, we set the username to the script name e.g. "script_test"
- 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"
- 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
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
askForJwtToken()
Handles the creation and set of the JWT Token.
private
askForJwtToken(JTable $table) : string|null
Parameters
- $table : JTable
-
- JTable object.