Documentation

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
uses
Client

For HTTP requests

uses
Psr7

For handling file streams

example

Usage example

use myCEESV\CeesvApiClient;

// Initialize CeesvApiClient object
$myCeesv = new CeesvApiClient($ceesvConfig);
if ($myCeesv->createDepot([$absolutePath], $ownerName))
{
    // SUCCESS
    ...
}
else
{
    // ERROR
    $error = $myCeesv->getError();
    echo '<p>' . $error['message'] . '</p>';
}
author

asteiner

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

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
throws
Exception

Error during the request

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
throws
Exception

If there is an error during the request.

Return values
bool

getError()

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
throws
Exception

If the request encounters an error.

Return values
false|string —

False if the request failed otherwise the response from the request.


        
On this page

Search results