mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-14 10:37:19 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
9
aws/Aws/Polly/Exception/PollyException.php
Normal file
9
aws/Aws/Polly/Exception/PollyException.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
namespace Aws\Polly\Exception;
|
||||
|
||||
use Aws\Exception\AwsException;
|
||||
|
||||
/**
|
||||
* Represents an error interacting with the **Amazon Polly** service.
|
||||
*/
|
||||
class PollyException extends AwsException {}
|
67
aws/Aws/Polly/PollyClient.php
Normal file
67
aws/Aws/Polly/PollyClient.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
namespace Aws\Polly;
|
||||
|
||||
use Aws\Api\Serializer\JsonBody;
|
||||
use Aws\AwsClient;
|
||||
use Aws\Signature\SignatureV4;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use GuzzleHttp\Psr7;
|
||||
|
||||
/**
|
||||
* This client is used to interact with the **Amazon Polly** service.
|
||||
* @method \Aws\Result deleteLexicon(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise deleteLexiconAsync(array $args = [])
|
||||
* @method \Aws\Result describeVoices(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise describeVoicesAsync(array $args = [])
|
||||
* @method \Aws\Result getLexicon(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise getLexiconAsync(array $args = [])
|
||||
* @method \Aws\Result listLexicons(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise listLexiconsAsync(array $args = [])
|
||||
* @method \Aws\Result putLexicon(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise putLexiconAsync(array $args = [])
|
||||
* @method \Aws\Result synthesizeSpeech(array $args = [])
|
||||
* @method \GuzzleHttp\Promise\Promise 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 Aws\Polly\PollyClient::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 = Psr7\build_query($queryArray);
|
||||
$uri = $uri->withQuery($query);
|
||||
|
||||
$request = new Request('GET', $uri);
|
||||
$request = $request->withBody(Psr7\stream_for(''));
|
||||
$signer = new SignatureV4('polly', $this->getRegion());
|
||||
return (string) $signer->presign(
|
||||
$request,
|
||||
$this->getCredentials()->wait(),
|
||||
'+15 minutes'
|
||||
)->getUri();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue