PHP code example of ometra / apollo-sdk

1. Go to this page and download the library: Download ometra/apollo-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ometra / apollo-sdk example snippets


$proteus = Apollo::proteus()->asApplication();

$media = $proteus->media()->index(['type' => 'image']);
$grant = $proteus->lightPath($grantId)->extend(3600);

$items = Apollo::proteus()->media()->index(['type' => 'image']);

$created = Apollo::proteus()->media()->store([
    'directory_id' => $directoryId,
    'media' => [$request->file('image')],
    'metadata' => ['source' => 'apollo'],
]);

$media = Apollo::proteus()->media($mediaId);

$detail = $media->show();
$download = $media->download('mp4');
$thumbnail = $media->thumbnail();
$deleted = $media->destroy();

$values = Apollo::proteus()->media()->metadata()->values('artist');

$metadata = Apollo::proteus()->media($mediaId)->metadata();

$metadata->store(['metadata' => ['artist' => 'Ometra']]);
$metadata->update(['metadata' => ['artist' => 'Apollo']]);

$artist = Apollo::proteus()->media($mediaId)->metadata('artist')->show();
Apollo::proteus()->media($mediaId)->metadata('artist')->destroy();

$response = Apollo::proteus()
    ->media($mediaId)
    ->lightPath()
    ->request(extension: 'mp4', ttlSeconds: 3600);

$grantId = $response['data']['id_lightpath_grant'];

Apollo::proteus()->lightPath($grantId)->extend(3600);
Apollo::proteus()->lightPath($grantId)->revoke();

use Ometra\Apollo\Sdk\Modules\Proteus\Enums\DirectoryApplicationPermission;

$directories = Apollo::proteus()->directories()->index();
$created = Apollo::proteus()->directories()->store($data);

$directory = Apollo::proteus()->directories($directoryId);
$detail = $directory->show();
$directory->destroy();

$grant = $directory
    ->applicationGrants()
    ->request(
        clientReference: 'flare:playlist:42',
        permission: DirectoryApplicationPermission::READ,
    );

Apollo::proteus()
    ->asApplication()
    ->directories()
    ->applicationGrants($applicationGrantId)
    ->revoke();

Apollo::proteus()->categories()->index();
Apollo::proteus()->categories()->store($data);

$playlist = Apollo::flare()->playlists($playlistId)->show();
$items = Apollo::flare()->playlists($playlistId)->items()->index();

$group = Apollo::flare()->stations()->groups($groupUri)->show();
Apollo::flare()->stations()->groups($groupUri)->destroy();
Apollo::flare()->stations()->groups()->invalidateCache();

$groups = Apollo::pulse()->groups()->index($filters);
$catalog = Apollo::pulse()->groups()->catalog()->index($filters);
Apollo::pulse()->groups()->stationCache()->invalidate($groupUris);

$campaigns = Apollo::ignis()
    ->groups($groupId)
    ->campaigns()
    ->index();

$campaign = Apollo::ignis()
    ->groups($groupId)
    ->campaigns($campaignId)
    ->show();
bash
php artisan vendor:publish --tag=apollo-error-pages