[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: VideoStreamRequest.php
<?php /** * Written by ToshY, <24-10-2021> */ declare(strict_types=1); namespace ToshY\BunnyNet; use ToshY\BunnyNet\Client\BunnyClient; use ToshY\BunnyNet\Enum\Host; use ToshY\BunnyNet\Enum\Stream\CollectionEndpoint; use ToshY\BunnyNet\Enum\Stream\VideoEndpoint; use ToshY\BunnyNet\Exception\FileDoesNotExistException; /** * Class Stream * @link https://docs.bunny.net/reference/api-overview */ final class VideoStreamRequest extends BunnyClient { /** @var string */ protected string $apiKey; /** * Stream constructor. * @param string $apiKey */ public function __construct( string $apiKey ) { $this->apiKey = $apiKey; parent::__construct(Host::STREAM_ENDPOINT); } /** * @param int $libraryId * @param string $collectionId * @return array */ public function getCollection(int $libraryId, string $collectionId): array { $endpoint = CollectionEndpoint::GET_COLLECTION; return $this->request( $endpoint, [$libraryId, $collectionId], ); } /** * @param int $libraryId * @param string $collectionId * @param array $body * @return array * @throws Exception\InvalidBodyParameterTypeException */ public function updateCollection(int $libraryId, string $collectionId, array $body): array { $endpoint = CollectionEndpoint::UPDATE_COLLECTION; $body = $this->validateBodyField($body, $endpoint['body']); return $this->request( $endpoint, [$libraryId, $collectionId], [], $body ); } /** * @param int $libraryId * @param array $body * @return array * @throws Exception\InvalidBodyParameterTypeException */ public function createCollection(int $libraryId, array $body): array { $endpoint = CollectionEndpoint::CREATE_COLLECTION; $body = $this->validateBodyField($body, $endpoint['body']); return $this->request( $endpoint, [$libraryId], [], $body ); } /** * @param int $libraryId * @param string $collectionId * @return array */ public function deleteCollection(int $libraryId, string $collectionId): array { $endpoint = CollectionEndpoint::DELETE_COLLECTION; return $this->request( $endpoint, [$libraryId, $collectionId], ); } /** * @param int $libraryId * @param array $query * @return array * @throws Exception\InvalidBodyParameterTypeException */ public function getCollectionList(int $libraryId, array $query = []): array { $endpoint = CollectionEndpoint::GET_COLLECTION_LIST; $query = $this->validateBodyField($query, $endpoint['query']); return $this->request( $endpoint, [$libraryId], $query, ); } /** * @param int $libraryId * @param string $videoId * @return array */ public function getVideo(int $libraryId, string $videoId): array { $endpoint = VideoEndpoint::GET_VIDEO; return $this->request( $endpoint, [$libraryId, $videoId], [] ); } /** * @param int $libraryId * @param string $videoId * @param array $body * @return array * @throws Exception\InvalidBodyParameterTypeException */ public function updateVideo(int $libraryId, string $videoId, array $body): array { $endpoint = VideoEndpoint::UPDATE_VIDEO; $body = $this->validateBodyField($body, $endpoint['body']); return $this->request( $endpoint, [$libraryId, $videoId], [], $body ); } /** * @param int $libraryId * @param string $videoId * @return array */ public function deleteVideo(int $libraryId, string $videoId): array { $endpoint = VideoEndpoint::DELETE_VIDEO; return $this->request( $endpoint, [$libraryId, $videoId] ); } /** * @param int $libraryId * @param string $videoId * @param string $localFilePath * @return array * @throws FileDoesNotExistException */ public function uploadVideo(int $libraryId, string $videoId, string $localFilePath): array { $endpoint = VideoEndpoint::UPLOAD_VIDEO; $body = $this->openFileStream($localFilePath); return $this->request( $endpoint, [$libraryId, $videoId], [], $body ); } /** * @param int $libraryId * @param string $videoId * @return array */ public function reencodeVideo(int $libraryId, string $videoId): array { $endpoint = VideoEndpoint::REENCODE_VIDEO; return $this->request( $endpoint, [$libraryId, $videoId], ); } /** * @param int $libraryId * @param array $query * @return array * @throws Exception\InvalidQueryParameterRequirementException * @throws Exception\InvalidQueryParameterTypeException */ public function listVideos(int $libraryId, array $query = []): array { $endpoint = VideoEndpoint::LIST_VIDEOS; $query = $this->validateQueryField($query, $endpoint['query']); return $this->request( $endpoint, [$libraryId], $query ); } /** * @param int $libraryId * @param array $body * @return array * @throws Exception\InvalidBodyParameterTypeException */ public function createVideo(int $libraryId, array $body): array { $endpoint = VideoEndpoint::CREATE_VIDEO; $body = $this->validateBodyField($body, $endpoint['body']); return $this->request( $endpoint, [$libraryId], [], $body ); } /** * @param int $libraryId * @param string $videoId * @param array $query * @return array * @throws Exception\InvalidQueryParameterRequirementException * @throws Exception\InvalidQueryParameterTypeException */ public function setThumbnail(int $libraryId, string $videoId, array $query): array { $endpoint = VideoEndpoint::SET_THUMBNAIL; $query = $this->validateQueryField($query, $endpoint['query']); return $this->request( $endpoint, [$libraryId, $videoId], $query ); } /** * @param int $libraryId * @param string $videoId * @param array $body * @return array * @throws Exception\InvalidBodyParameterTypeException */ public function fetchVideo(int $libraryId, string $videoId, array $body): array { $endpoint = VideoEndpoint::FETCH_VIDEO; $body = $this->validateBodyField($body, $endpoint['body']); return $this->request( $endpoint, [$libraryId, $videoId], [], $body ); } /** * @param int $libraryId * @param array $body * @param array $query * @return array * @throws Exception\InvalidBodyParameterTypeException * @throws Exception\InvalidQueryParameterRequirementException * @throws Exception\InvalidQueryParameterTypeException */ public function fetchVideoToCollection(int $libraryId, array $body, array $query = []): array { $endpoint = VideoEndpoint::FETCH_VIDEO_TO_COLLECTION; $query = $this->validateQueryField($query, $endpoint['query']); $body = $this->validateBodyField($body, $endpoint['body']); return $this->request( $endpoint, [$libraryId], $query, $body ); } /** * @param int $libraryId * @param string $videoId * @param string $sourceLanguage * @param array $body * @return array * @throws Exception\InvalidBodyParameterTypeException */ public function addCaption(int $libraryId, string $videoId, string $sourceLanguage, array $body): array { $endpoint = VideoEndpoint::ADD_CAPTION; $body = $this->validateBodyField($body, $endpoint['body']); return $this->request( $endpoint, [$libraryId, $videoId, $sourceLanguage], [], $body ); } /** * @param int $libraryId * @param string $videoId * @param string $sourceLanguage * @return array */ public function deleteCaption(int $libraryId, string $videoId, string $sourceLanguage): array { $endpoint = VideoEndpoint::DELETE_CAPTION; return $this->request( $endpoint, [$libraryId, $videoId, $sourceLanguage], [] ); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.84 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285