Вход Регистрация
Файл: sngine-v2.8/Script/includes/libs/AWS/Aws/Polly/PollyClient.php
Строк: 78
<?php
namespace AwsPolly;

use 
AwsApiSerializerJsonBody;
use 
AwsAwsClient;
use 
AwsSignatureSignatureV4;
use 
GuzzleHttpPsr7Request;
use 
GuzzleHttpPsr7Uri;
use 
GuzzleHttpPsr7;

/**
 * This client is used to interact with the **Amazon Polly** service.
 * @method AwsResult deleteLexicon(array $args = [])
 * @method GuzzleHttpPromisePromise deleteLexiconAsync(array $args = [])
 * @method AwsResult describeVoices(array $args = [])
 * @method GuzzleHttpPromisePromise describeVoicesAsync(array $args = [])
 * @method AwsResult getLexicon(array $args = [])
 * @method GuzzleHttpPromisePromise getLexiconAsync(array $args = [])
 * @method AwsResult getSpeechSynthesisTask(array $args = [])
 * @method GuzzleHttpPromisePromise getSpeechSynthesisTaskAsync(array $args = [])
 * @method AwsResult listLexicons(array $args = [])
 * @method GuzzleHttpPromisePromise listLexiconsAsync(array $args = [])
 * @method AwsResult listSpeechSynthesisTasks(array $args = [])
 * @method GuzzleHttpPromisePromise listSpeechSynthesisTasksAsync(array $args = [])
 * @method AwsResult putLexicon(array $args = [])
 * @method GuzzleHttpPromisePromise putLexiconAsync(array $args = [])
 * @method AwsResult startSpeechSynthesisTask(array $args = [])
 * @method GuzzleHttpPromisePromise startSpeechSynthesisTaskAsync(array $args = [])
 * @method AwsResult synthesizeSpeech(array $args = [])
 * @method GuzzleHttpPromisePromise synthesizeSpeechAsync(array $args = [])
 */
class PollyClient extends AwsClient
{
    
/** @var JsonBody */
    
private $formatter;

    
/**
     * Create a pre-signed URL for Polly operation `SynthesizeSpeech`
     *
     * @param array $args parameters array for `SynthesizeSpeech`
     *                    More information @see AwsPollyPollyClient::SynthesizeSpeech
     *
     * @return string
     */
    
public function createSynthesizeSpeechPreSignedUrl(array $args)
    {
        
$uri = new Uri($this->getEndpoint());
        
$uri $uri->withPath('/v1/speech');

        
// Formatting parameters follows rest-json protocol
        
$this->formatter $this->formatter ?: new JsonBody($this->getApi());
        
$queryArray json_decode(
            
$this->formatter->build(
                
$this->getApi()->getOperation('SynthesizeSpeech')->getInput(),
                
$args
            
),
            
true
        
);

        
// Mocking a 'GET' request in pre-signing the Url
        
$query Psr7build_query($queryArray);
        
$uri $uri->withQuery($query);

        
$request = new Request('GET'$uri);
        
$request $request->withBody(Psr7stream_for(''));
        
$signer = new SignatureV4('polly'$this->getRegion());
        return (string) 
$signer->presign(
            
$request,
            
$this->getCredentials()->wait(),
            
'+15 minutes'
        
)->getUri();
    }
}
Онлайн: 0
Реклама