CeesvApiClient
in package
Provides authentication and depot creation functionality for CEESV services.
This class manages OAuth 2.0 authentication to retrieve and maintain access tokens and supports creating depots.
Features:
- Authentication using client credentials via OAuth 2.0
- Automatic token renewal when expired
- Depot creation with file uploads (a depot is a storage or archive for files, where CEESV stores the data)
- Error handling with detailed information
Tags
Table of Contents
Properties
- $accessToken : mixed
- $tokenExpiration : mixed
Methods
- __construct() : mixed
- Initializes a CeesvApiClient object with the required configuration parameters.
- createDepot() : bool
- Creates a new depot
- generateScope() : string
- Generates the scope string for the OAuth request.
- getAccessToken() : bool
- Gets an access token from the OAuth server.
- getError() : array<string|int, mixed>
- Returns the current error array.
- isTokenExpired() : bool
- Checks if the current access token is expired.
- request() : false|string
- Performs a request to the specified URL with optional headers and POST data.
Properties
$accessToken
public
mixed
$accessToken
$tokenExpiration
public
mixed
$tokenExpiration
Methods
__construct()
Initializes a CeesvApiClient object with the required configuration parameters.
public
__construct(string $projectId, string $clientId, string $clientSecret, string $tokenUrl, string $depotUrl) : mixed
Parameters
- $projectId : string
-
: Project ID for CEESV integration
- $clientId : string
-
: Client ID provided by CEESV
- $clientSecret : string
-
: Client Secret provided by CEESV
- $tokenUrl : string
-
: Token URL for OAuth 2.0 authentication
- $depotUrl : string
-
: Depot URL for create depot with files
createDepot()
Creates a new depot
public
createDepot(array<string|int, mixed> $files[, string|null $ownerName = null ]) : bool
Parameters
- $files : array<string|int, mixed>
-
Array of absolute file paths
- $ownerName : string|null = null
-
Name of owner (optional, max 255 characters)
Tags
Return values
bool —True if the depot is created
generateScope()
Generates the scope string for the OAuth request.
public
generateScope() : string
Return values
string —The generated scope string.
getAccessToken()
Gets an access token from the OAuth server.
public
getAccessToken() : bool
Tags
Return values
boolgetError()
Returns the current error array.
public
getError() : array<string|int, mixed>
Return values
array<string|int, mixed> —The current error information.
isTokenExpired()
Checks if the current access token is expired.
public
isTokenExpired() : bool
Return values
bool —True if the token is expired, false otherwise.
request()
Performs a request to the specified URL with optional headers and POST data.
protected
request(string $url, array<string|int, mixed> $options) : false|string
Parameters
- $url : string
-
The URL for the request
- $options : array<string|int, mixed>
-
All other informations for the request
Tags
Return values
false|string —False if the request failed otherwise the response from the request.