File manager - Edit - /var/www/payraty/helpdesk/vendor/muxinc/mux-php/MuxPhp/Api/URLSigningKeysApi.php
Back
<?php /** * URLSigningKeysApi * 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; /** * URLSigningKeysApi Class Doc Comment * * @category Class * @package MuxPhp * @author Mux API team * @link https://docs.mux.com */ class URLSigningKeysApi { /** * @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 createUrlSigningKey * * Create a URL signing key * * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \MuxPhp\Models\SigningKeyResponse */ public function createUrlSigningKey() { list($response) = $this->createUrlSigningKeyWithHttpInfo(); return $response; } /** * Operation createUrlSigningKeyWithHttpInfo * * Create a URL signing key * * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \MuxPhp\Models\SigningKeyResponse, HTTP status code, HTTP response headers (array of strings) */ public function createUrlSigningKeyWithHttpInfo() { $request = $this->createUrlSigningKeyRequest(); 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 201: if ('\MuxPhp\Models\SigningKeyResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = (string) $responseBody; } return [ ObjectSerializer::deserialize($content, '\MuxPhp\Models\SigningKeyResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } $returnType = '\MuxPhp\Models\SigningKeyResponse'; $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 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\MuxPhp\Models\SigningKeyResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); break; } throw $e; } } /** * Operation createUrlSigningKeyAsync * * Create a URL signing key * * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function createUrlSigningKeyAsync() { return $this->createUrlSigningKeyAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; } ); } /** * Operation createUrlSigningKeyAsyncWithHttpInfo * * Create a URL signing key * * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function createUrlSigningKeyAsyncWithHttpInfo() { $returnType = '\MuxPhp\Models\SigningKeyResponse'; $request = $this->createUrlSigningKeyRequest(); 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 'createUrlSigningKey' * * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ public function createUrlSigningKeyRequest() { $resourcePath = '/video/v1/signing-keys'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; 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( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** * Operation deleteUrlSigningKey * * Delete a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ public function deleteUrlSigningKey($signing_key_id) { $this->deleteUrlSigningKeyWithHttpInfo($signing_key_id); } /** * Operation deleteUrlSigningKeyWithHttpInfo * * Delete a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteUrlSigningKeyWithHttpInfo($signing_key_id) { $request = $this->deleteUrlSigningKeyRequest($signing_key_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() ); } return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { } throw $e; } } /** * Operation deleteUrlSigningKeyAsync * * Delete a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteUrlSigningKeyAsync($signing_key_id) { return $this->deleteUrlSigningKeyAsyncWithHttpInfo($signing_key_id) ->then( function ($response) { return $response[0]; } ); } /** * Operation deleteUrlSigningKeyAsyncWithHttpInfo * * Delete a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function deleteUrlSigningKeyAsyncWithHttpInfo($signing_key_id) { $returnType = ''; $request = $this->deleteUrlSigningKeyRequest($signing_key_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { return [null, $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 'deleteUrlSigningKey' * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ public function deleteUrlSigningKeyRequest($signing_key_id) { // verify the required parameter 'signing_key_id' is set if ($signing_key_id === null || (is_array($signing_key_id) && count($signing_key_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $signing_key_id when calling deleteUrlSigningKey' ); } $resourcePath = '/video/v1/signing-keys/{SIGNING_KEY_ID}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // path params if ($signing_key_id !== null) { $resourcePath = str_replace( '{' . 'SIGNING_KEY_ID' . '}', ObjectSerializer::toPathValue($signing_key_id), $resourcePath ); } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( [] ); } else { $headers = $this->headerSelector->selectHeaders( [], [] ); } // 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( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } /** * Operation getUrlSigningKey * * Retrieve a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \MuxPhp\Models\SigningKeyResponse */ public function getUrlSigningKey($signing_key_id) { list($response) = $this->getUrlSigningKeyWithHttpInfo($signing_key_id); return $response; } /** * Operation getUrlSigningKeyWithHttpInfo * * Retrieve a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \MuxPhp\Models\SigningKeyResponse, HTTP status code, HTTP response headers (array of strings) */ public function getUrlSigningKeyWithHttpInfo($signing_key_id) { $request = $this->getUrlSigningKeyRequest($signing_key_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\SigningKeyResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = (string) $responseBody; } return [ ObjectSerializer::deserialize($content, '\MuxPhp\Models\SigningKeyResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } $returnType = '\MuxPhp\Models\SigningKeyResponse'; $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\SigningKeyResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); break; } throw $e; } } /** * Operation getUrlSigningKeyAsync * * Retrieve a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getUrlSigningKeyAsync($signing_key_id) { return $this->getUrlSigningKeyAsyncWithHttpInfo($signing_key_id) ->then( function ($response) { return $response[0]; } ); } /** * Operation getUrlSigningKeyAsyncWithHttpInfo * * Retrieve a URL signing key * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function getUrlSigningKeyAsyncWithHttpInfo($signing_key_id) { $returnType = '\MuxPhp\Models\SigningKeyResponse'; $request = $this->getUrlSigningKeyRequest($signing_key_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 'getUrlSigningKey' * * @param string $signing_key_id The ID of the signing key. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ public function getUrlSigningKeyRequest($signing_key_id) { // verify the required parameter 'signing_key_id' is set if ($signing_key_id === null || (is_array($signing_key_id) && count($signing_key_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $signing_key_id when calling getUrlSigningKey' ); } $resourcePath = '/video/v1/signing-keys/{SIGNING_KEY_ID}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // path params if ($signing_key_id !== null) { $resourcePath = str_replace( '{' . 'SIGNING_KEY_ID' . '}', ObjectSerializer::toPathValue($signing_key_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 ); } /** * Operation listUrlSigningKeys * * List URL signing keys * * @param int $limit Number of items to include in the response (optional, default to 25) * @param int $page Offset by this many pages, of the size of `limit` (optional, default to 1) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \MuxPhp\Models\ListSigningKeysResponse */ public function listUrlSigningKeys($limit = 25, $page = 1) { list($response) = $this->listUrlSigningKeysWithHttpInfo($limit, $page); return $response; } /** * Operation listUrlSigningKeysWithHttpInfo * * List URL signing keys * * @param int $limit Number of items to include in the response (optional, default to 25) * @param int $page Offset by this many pages, of the size of `limit` (optional, default to 1) * * @throws \MuxPhp\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \MuxPhp\Models\ListSigningKeysResponse, HTTP status code, HTTP response headers (array of strings) */ public function listUrlSigningKeysWithHttpInfo($limit = 25, $page = 1) { $request = $this->listUrlSigningKeysRequest($limit, $page); 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\ListSigningKeysResponse' === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = (string) $responseBody; } return [ ObjectSerializer::deserialize($content, '\MuxPhp\Models\ListSigningKeysResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } $returnType = '\MuxPhp\Models\ListSigningKeysResponse'; $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\ListSigningKeysResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); break; } throw $e; } } /** * Operation listUrlSigningKeysAsync * * List URL signing keys * * @param int $limit Number of items to include in the response (optional, default to 25) * @param int $page Offset by this many pages, of the size of `limit` (optional, default to 1) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function listUrlSigningKeysAsync($limit = 25, $page = 1) { return $this->listUrlSigningKeysAsyncWithHttpInfo($limit, $page) ->then( function ($response) { return $response[0]; } ); } /** * Operation listUrlSigningKeysAsyncWithHttpInfo * * List URL signing keys * * @param int $limit Number of items to include in the response (optional, default to 25) * @param int $page Offset by this many pages, of the size of `limit` (optional, default to 1) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ public function listUrlSigningKeysAsyncWithHttpInfo($limit = 25, $page = 1) { $returnType = '\MuxPhp\Models\ListSigningKeysResponse'; $request = $this->listUrlSigningKeysRequest($limit, $page); 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 'listUrlSigningKeys' * * @param int $limit Number of items to include in the response (optional, default to 25) * @param int $page Offset by this many pages, of the size of `limit` (optional, default to 1) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ public function listUrlSigningKeysRequest($limit = 25, $page = 1) { $resourcePath = '/video/v1/signing-keys'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // query params if ($limit !== null) { if('form' === 'form' && is_array($limit)) { foreach($limit as $key => $value) { $queryParams[$key] = $value; } } else { $queryParams['limit'] = $limit; } } // query params if ($page !== null) { if('form' === 'form' && is_array($page)) { foreach($page as $key => $value) { $queryParams[$key] = $value; } } else { $queryParams['page'] = $page; } } 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