TokenService
in package
Table of Contents
Constants
- TOKEN_ENDPOINT : mixed = '/system/token'
Properties
- $apiBaseUrl : string
- $httpClient : HttpClientInterface
- $secretApiKey : string
- $systemToken : string|null
Methods
- __construct() : mixed
- getSystemToken() : string|null
- Récupère le token système pour les appels API
- prepareRequestOptions() : array<string|int, mixed>
- Prépare les options pour les requêtes API avec le token système
- fetchSystemToken() : void
- Récupère le token depuis l'API
Constants
TOKEN_ENDPOINT
private
mixed
TOKEN_ENDPOINT
= '/system/token'
Properties
$apiBaseUrl
private
string
$apiBaseUrl
$httpClient
private
HttpClientInterface
$httpClient
$secretApiKey
private
string
$secretApiKey
$systemToken
private
string|null
$systemToken
= null
Methods
__construct()
public
__construct(HttpClientInterface $httpClient, string $api_base_url, string $secret_api_key) : mixed
Parameters
- $httpClient : HttpClientInterface
- $api_base_url : string
- $secret_api_key : string
getSystemToken()
Récupère le token système pour les appels API
public
getSystemToken() : string|null
Return values
string|null —Le token système ou null en cas d'erreur
prepareRequestOptions()
Prépare les options pour les requêtes API avec le token système
public
prepareRequestOptions([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed> = []
-
Options existantes pour la requête
Return values
array<string|int, mixed> —Options avec le token ajouté
fetchSystemToken()
Récupère le token depuis l'API
private
fetchSystemToken() : void