Cloud Storage
This PHP package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Build package: org.openapitools.codegen.languages.PhpClientCodegen
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json
:
{
"require": {
"firebase/php-jwt": "5.2.0",
"bigfs/bigfs-client": "0.1.0"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use \Firebase\JWT\JWT;
date_default_timezone_set("UTC");
$jwt_secret = "johndoe";
$now = new DateTime();
$payload = array(
"nbf" => $now->getTimestamp()
);
$jwt = JWT::encode($payload, $jwt_secret);
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'Bearer ' . $jwt);
$apiInstance = new OpenAPI\Client\Api\ActivityLogsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$author = ''; // string | Filter by author
$created_at_system__before = null; // \DateTime | Filter by created_at_system
$created_at_system__after = null; // \DateTime | Filter by created_at_system
$created_at_user__before = null; // \DateTime | Filter by created_at_user
$created_at_user__after = ""; // \DateTime | Filter by created_at_user
$page = 1; // int | Page number
$per_page = 1; // int | Per page row count
$level = 1; // int | log level
$message = null; // string | log message
$object = null; // string | object
$subject = null; // string | log subject
$action = null; // string | log action
try {
$resultActivityLog = $apiInstance->activityLogsList($author, $created_at_system__before, $created_at_system__after, $created_at_user__before, $created_at_user__after, $page, $per_page, $level, $message, $object, $subject, $action);
print_r($resultActivityLog);
} catch (Exception $e) {
echo 'Exception when calling ActivityLogsApi->activityLogsList: ', $e->getMessage(), PHP_EOL;
}
$fileApiInstance = new OpenAPI\Client\Api\FilesApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$flMetaLabels = array('x' => 'y');
$fileMetaLabelsInstance = array();
$fileMetaLabelsInstance[] = new OpenAPI\Client\Model\FileMetaLabels($flMetaLabels);
$fl = array();
$fl['name'] = 'new_img.png';
$fl['labels'] = $fileMetaLabelsInstance;
$fileMetaInstance = new OpenAPI\Client\Model\FileMeta($fl);
try {
$result = $fileApiInstance->create($fileMetaInstance);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->create: ', $e->getMessage(), PHP_EOL;
}
$file1 = new SPLFileObject('./splitonfivemegabytesaa');
$file2 = new SPLFileObject('./splitonfivemegabytesab');
try {
$resultUpload1 = $fileApiInstance->uploadContent($result['file_id'], $file1, 1, 'bytes=0-5242880');
} catch (Exception $e) {
echo 'Exception when calling FilesApi->uploadContent: ', $e->getMessage(), PHP_EOL;
}
try {
$resultUpload2 = $fileApiInstance->uploadContent($result['file_id'], $file2, 2, 'bytes=5242881-6609827');
} catch (Exception $e) {
echo 'Exception when calling FilesApi->uploadContent: ', $e->getMessage(), PHP_EOL;
}
$parts = array();
$parts['parts'] = [1, 2];
$multipartUploadInstance = new OpenAPI\Client\Model\MultipartUpload($parts);
try {
$resultCompleteUpload = $fileApiInstance->completeMultipartUpload($result['file_id'], $multipartUploadInstance);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->completeMultipartUpload: ', $e->getMessage(), PHP_EOL;
}
$xCloudStorageVersion = 1;
try {
$resultGet = $fileApiInstance->get($result['file_id'], "bytes=0-3609000", $xCloudStorageVersion);
} catch (Exception $e) {
echo 'Exception when calling FilesApi->completeMultipartUpload: ', $e->getMessage(), PHP_EOL;
}
$ouput = '';
while (!$resultGet->eof()) {
$output .= $resultGet->fgets();
}
$file = new SplFileObject("new_img.png", 'w+');
$file->fwrite($output);
?>
All URIs are relative to https://storage.example.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
ActivityLogsApi | activityLogsList | GET /activity-logs/ | Activity logs list |
ActivityLogsApi | createActivityLog | POST /activity-logs/ | Create activity log |
DataExportsApi | createDataExport | POST /data-exports/ | Create data export |
DataExportsApi | getDataExport | GET /data-exports/{data_export_id}/ | Get data export |
DataExportsApi | getDataExportPartsList | GET /data-exports/{data_export_id}/parts/ | Get data export parts list |
FilesApi | callList | GET /files/ | Files list |
FilesApi | completeMultipartUpload | POST /files/{file_id}/complete-mutipart-upload/ | Complete multipart upload |
FilesApi | create | POST /files/ | Create file |
FilesApi | delete | DELETE /files/{file_id}/ | Delete file |
FilesApi | get | GET /files/{file_id}/ | Get file |
FilesApi | getFileInfo | HEAD /files/{file_id}/ | Get file's info |
FilesApi | updateMeta | PUT /files/{file_id}/meta | Update file's meta |
FilesApi | uploadContent | PUT /files/{file_id}/ | Upload content |
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header