File manager - Edit - /var/www/payraty/helpdesk/vendor/muxinc/mux-php/MuxPhp/Api/PlaybackIDApi.php
Back
<?php /** * PlaybackIDApi * PHP version 7.2 * * @category Class * @package MuxPhp * @author Mux API team * @link https://docs.mux.com */ /** * Mux API * * Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. * * The version of the OpenAPI document: v1 * Contact: devex@mux.com * Generated by: https://openapi-generator.tech * OpenAPI Generator version: 5.0.1 */ /** * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ namespace MuxPhp\Api; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use MuxPhp\ApiException; use MuxPhp\Configuration; use MuxPhp\HeaderSelector; use MuxPhp\ObjectSerializer; /** * PlaybackIDApi Class Doc Comment * * @category Class * @package MuxPhp * @author Mux API team * @link https://docs.mux.com */ class PlaybackIDApi { /** * @var ClientInterface */ protected $client; /** * @var Configuration */ protected $config; /** * @var HeaderSelector */ protected $headerSelector; /** * @var int Host index */ protected $hostIndex; /** * @param ClientInterface $client * @param Configuration $config * @param HeaderSelector $selector * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null, $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } /** * Set the host index * * @param int $hostIndex Host index (required) */ public function setHostIndex($hostIndex) { $this->hostIndex = $hostIndex; } /** * Get the host index * * @return int Host index */ public function getHostIndex() { return $this->hostIndex; } /** * @return Configuration */ public function getConfig() { return $this->config; } /** * Operation getAssetOrLivestreamId * * Retrieve an asset or live stream ID * * @param string $playback_id The live stream's playback ID. (required) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \MuxPhp\Models\GetAssetOrLiveStreamIdResponse */ public function getAssetOrLivestreamId($playback_id) { list($response) = $this->getAssetOrLivestreamIdWithHttpInfo($playback_id); return $response; } /** * Operation getAssetOrLivestreamIdWithHttpInfo * * Retrieve an asset or live stream ID * * @param string $playback_id The live stream's playback ID. (required) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \MuxPhp\Models\GetAssetOrLiveStreamIdResponse, HTTP status code, HTTP response headers (array of strings) */ public function getAssetOrLivestreamIdWithHttpInfo($playback_id) { $request = $this->getAssetOrLivestreamIdRequest($playback_id); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null ); } $statusCode = $response->getStatusCode(); if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $request->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } $responseBody = $response->getBody(); switch($statusCode) { case 200: if ('\MuxPhp\Models\GetAssetOrLiveStreamIdResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = (string) $responseBody; } return [ ObjectSerializer::deserialize($content, '\MuxPhp\Models\GetAssetOrLiveStreamIdResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } $returnType = '\MuxPhp\Models\GetAssetOrLiveStreamIdResponse'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = (string) $responseBody; } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\MuxPhp\Models\GetAssetOrLiveStreamIdResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); break; } throw $e; } } /** * Operation getAssetOrLivestreamIdAsync * * Retrieve an asset or live stream ID * * @param string $playback_id The live stream's playback ID. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getAssetOrLivestreamIdAsync($playback_id) { return $this->getAssetOrLivestreamIdAsyncWithHttpInfo($playback_id) ->then( function ($response) { return $response[0]; } ); } /** * Operation getAssetOrLivestreamIdAsyncWithHttpInfo * * Retrieve an asset or live stream ID * * @param string $playback_id The live stream's playback ID. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getAssetOrLivestreamIdAsyncWithHttpInfo($playback_id) { $returnType = '\MuxPhp\Models\GetAssetOrLiveStreamIdResponse'; $request = $this->getAssetOrLivestreamIdRequest($playback_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = (string) $responseBody; } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } ); } /** * Create request for operation 'getAssetOrLivestreamId' * * @param string $playback_id The live stream's playback ID. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ public function getAssetOrLivestreamIdRequest($playback_id) { // verify the required parameter 'playback_id' is set if ($playback_id === null || (is_array($playback_id) && count($playback_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $playback_id when calling getAssetOrLivestreamId' ); } $resourcePath = '/video/v1/playback-ids/{PLAYBACK_ID}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // path params if ($playback_id !== null) { $resourcePath = str_replace( '{' . 'PLAYBACK_ID' . '}', ObjectSerializer::toPathValue($playback_id), $resourcePath ); } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], [] ); } // for model (json/xml) if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; foreach ($formParamValueItems as $formParamValueItem) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValueItem ]; } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { // for HTTP post (form) $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } // this endpoint requires HTTP basic authentication if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); // MUX: adds support for array params. // TODO: future upstream? $query = ObjectSerializer::buildBetterQuery($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** * Create http client option * * @throws \RuntimeException on file opening failure * @return array of http client options */ protected function createHttpClientOption() { $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); } } return $options; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings