Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.17.0 #87

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,17 @@ MuxPhp/Models/UpdateAssetMasterAccessRequest.php
MuxPhp/Models/UpdateAssetRequest.php
MuxPhp/Models/UpdateLiveStreamEmbeddedSubtitlesRequest.php
MuxPhp/Models/UpdateLiveStreamGeneratedSubtitlesRequest.php
MuxPhp/Models/UpdateLiveStreamNewAssetSettings.php
MuxPhp/Models/UpdateLiveStreamRequest.php
MuxPhp/Models/UpdateReferrerDomainRestrictionRequest.php
MuxPhp/Models/UpdateTranscriptionVocabularyRequest.php
MuxPhp/Models/UpdateUserAgentRestrictionRequest.php
MuxPhp/Models/UpdateWebInputUrlRequest.php
MuxPhp/Models/Upload.php
MuxPhp/Models/UploadError.php
MuxPhp/Models/UploadResponse.php
MuxPhp/Models/UserAgentRestrictionRequest.php
MuxPhp/Models/UserAgentRestrictionSettings.php
MuxPhp/Models/VideoView.php
MuxPhp/Models/VideoViewEvent.php
MuxPhp/Models/VideoViewResponse.php
Expand Down Expand Up @@ -349,13 +353,17 @@ docs/Model/UpdateAssetMasterAccessRequest.md
docs/Model/UpdateAssetRequest.md
docs/Model/UpdateLiveStreamEmbeddedSubtitlesRequest.md
docs/Model/UpdateLiveStreamGeneratedSubtitlesRequest.md
docs/Model/UpdateLiveStreamNewAssetSettings.md
docs/Model/UpdateLiveStreamRequest.md
docs/Model/UpdateReferrerDomainRestrictionRequest.md
docs/Model/UpdateTranscriptionVocabularyRequest.md
docs/Model/UpdateUserAgentRestrictionRequest.md
docs/Model/UpdateWebInputUrlRequest.md
docs/Model/Upload.md
docs/Model/UploadError.md
docs/Model/UploadResponse.md
docs/Model/UserAgentRestrictionRequest.md
docs/Model/UserAgentRestrictionSettings.md
docs/Model/VideoView.md
docs/Model/VideoViewEvent.md
docs/Model/VideoViewResponse.md
Expand Down
291 changes: 291 additions & 0 deletions MuxPhp/Api/PlaybackRestrictionsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,297 @@ public function updateReferrerDomainRestrictionRequest($playback_restriction_id,
);
}

/**
* Operation updateUserAgentRestriction
*
* Update the User Agent Restriction
*
* @param string $playback_restriction_id ID of the Playback Restriction. (required)
* @param \MuxPhp\Models\UpdateUserAgentRestrictionRequest $update_user_agent_restriction_request update_user_agent_restriction_request (required)
*
* @throws \MuxPhp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MuxPhp\Models\PlaybackRestrictionResponse
*/
public function updateUserAgentRestriction($playback_restriction_id, $update_user_agent_restriction_request)
{
list($response) = $this->updateUserAgentRestrictionWithHttpInfo($playback_restriction_id, $update_user_agent_restriction_request);
return $response;
}

/**
* Operation updateUserAgentRestrictionWithHttpInfo
*
* Update the User Agent Restriction
*
* @param string $playback_restriction_id ID of the Playback Restriction. (required)
* @param \MuxPhp\Models\UpdateUserAgentRestrictionRequest $update_user_agent_restriction_request (required)
*
* @throws \MuxPhp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MuxPhp\Models\PlaybackRestrictionResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function updateUserAgentRestrictionWithHttpInfo($playback_restriction_id, $update_user_agent_restriction_request)
{
$request = $this->updateUserAgentRestrictionRequest($playback_restriction_id, $update_user_agent_restriction_request);

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\PlaybackRestrictionResponse' === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = (string) $responseBody;
}

return [
ObjectSerializer::deserialize($content, '\MuxPhp\Models\PlaybackRestrictionResponse', []),
$response->getStatusCode(),
$response->getHeaders()
];
}

$returnType = '\MuxPhp\Models\PlaybackRestrictionResponse';
$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\PlaybackRestrictionResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}

/**
* Operation updateUserAgentRestrictionAsync
*
* Update the User Agent Restriction
*
* @param string $playback_restriction_id ID of the Playback Restriction. (required)
* @param \MuxPhp\Models\UpdateUserAgentRestrictionRequest $update_user_agent_restriction_request (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateUserAgentRestrictionAsync($playback_restriction_id, $update_user_agent_restriction_request)
{
return $this->updateUserAgentRestrictionAsyncWithHttpInfo($playback_restriction_id, $update_user_agent_restriction_request)
->then(
function ($response) {
return $response[0];
}
);
}

/**
* Operation updateUserAgentRestrictionAsyncWithHttpInfo
*
* Update the User Agent Restriction
*
* @param string $playback_restriction_id ID of the Playback Restriction. (required)
* @param \MuxPhp\Models\UpdateUserAgentRestrictionRequest $update_user_agent_restriction_request (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateUserAgentRestrictionAsyncWithHttpInfo($playback_restriction_id, $update_user_agent_restriction_request)
{
$returnType = '\MuxPhp\Models\PlaybackRestrictionResponse';
$request = $this->updateUserAgentRestrictionRequest($playback_restriction_id, $update_user_agent_restriction_request);

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 'updateUserAgentRestriction'
*
* @param string $playback_restriction_id ID of the Playback Restriction. (required)
* @param \MuxPhp\Models\UpdateUserAgentRestrictionRequest $update_user_agent_restriction_request (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateUserAgentRestrictionRequest($playback_restriction_id, $update_user_agent_restriction_request)
{
// verify the required parameter 'playback_restriction_id' is set
if ($playback_restriction_id === null || (is_array($playback_restriction_id) && count($playback_restriction_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $playback_restriction_id when calling updateUserAgentRestriction'
);
}
// verify the required parameter 'update_user_agent_restriction_request' is set
if ($update_user_agent_restriction_request === null || (is_array($update_user_agent_restriction_request) && count($update_user_agent_restriction_request) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_user_agent_restriction_request when calling updateUserAgentRestriction'
);
}

$resourcePath = '/video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}/user_agent';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;



// path params
if ($playback_restriction_id !== null) {
$resourcePath = str_replace(
'{' . 'PLAYBACK_RESTRICTION_ID' . '}',
ObjectSerializer::toPathValue($playback_restriction_id),
$resourcePath
);
}


if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}

// for model (json/xml)
if (isset($update_user_agent_restriction_request)) {
if ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_user_agent_restriction_request));
} else {
$httpBody = $update_user_agent_restriction_request;
}
} elseif (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(
'PUT',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}

/**
* Create http client option
*
Expand Down
4 changes: 2 additions & 2 deletions MuxPhp/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Configuration
*
* @var string
*/
protected $userAgent = 'OpenAPI-Generator/3.16.0/PHP';
protected $userAgent = 'OpenAPI-Generator/3.17.0/PHP';

/**
* Debug switch (default set to false)
Expand Down Expand Up @@ -400,7 +400,7 @@ public static function toDebugReport()
$report .= ' OS: ' . php_uname() . PHP_EOL;
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
$report .= ' The version of the OpenAPI document: v1' . PHP_EOL;
$report .= ' SDK Package Version: 3.16.0' . PHP_EOL;
$report .= ' SDK Package Version: 3.17.0' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;

return $report;
Expand Down
Loading
Loading