SCILLClient
Use this class to initiate APIs.
Constructor
Initiate an instance of the SCILLClient class with the api key created in the Admin Panel.
public function __construct($apiKey, $development = false);
Parameters
apiKey string
This is the app id of your application. Use the Admin Panel to reveal the app id for your application.
development boolean
Set to true
if you want to work with our development system. You should only do that upon request of our tech support
team. Otherwise just leave out or set to false
.
getAuthClient
Initiate an instance of the AuthApi with the API key of your application. Use this API to generate an access token.
Please note: This class should not be used in client side code (i.e. in the Browser or Web Apps) as the API key might be easily captured using Web console, giving the attacker a lot of power. Use this class in a NodeJS backend, serving your client.
public function getAuthClient($accessToken=null);
Parameters
accessToken string
You need to provide an access token that you previously generated with the AuthApi. Please check out the documentation about access tokens for more info.
Returns
An instance of the AuthApi class. Setup for production use.
getEventsClient
Initiate an instance of the EventsApi with the API key of your application. It’s used to send events required for challenges and battle passes.
public function getEventsClient();
Returns
An instance of the EventsApi class. Setup for production use.
getChallengesClient
public function getChallengesClient($accessToken);
Parameters
accessToken string
You need to provide an access token that you previously generated with the AuthApi. Please check out the documentation about access tokens for more info.
Returns
An instance of the ChallengesApi class. Setup for production use.
getBattlePassesClient
public function getBattlePassesClient($accessToken);
Parameters
accessToken string
You need to provide an access token that you previously generated with the AuthApi. Please check out the documentation about access tokens for more info.
Returns
An instance of the BattlePassesApi class. Setup for production use.
sendEvent
public function sendEvent($eventName, $userId, $sessionId, $metaData = array(), $eventType ='single');
Parameters
eventName string
The name of the event type. Please see [Event Types](/events.html for more info.
userId string
The user id of the user that should be attached to this event. Please see [User Ids](/api/authentication.html#user-ids for more info.
sessionId string
If you want to group events use the session id to group events.
metaData EventMetaData
A hash array with additional parameters that should be sent along this event. This is useful to store the weapon or the maps name. There are many properties. Please see [Event Types](/events.html for a list of properties available for the event type you want to send.
eventType string
Leave this to single
. Can also be group
which allows you to send multiple events in a group (requires sessionId
to
be set).
Returns
An instance of the \SCILL\Model\ActionResponse class.