Exemplo n.º 1
0
        public void PutLexiconMarshallTest()
        {
            var operation = service_model.FindOperation("PutLexicon");

            var request    = InstantiateClassGenerator.Execute <PutLexiconRequest>();
            var marshaller = new PutLexiconRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("PutLexicon", request, internalRequest, service_model);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       }
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();

            webResponse.Headers["Content-Length"] = UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString();
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = PutLexiconResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as PutLexiconResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Stores a pronunciation lexicon in an AWS Region. If a lexicon with the same name already
        /// exists in the region, it is overwritten by the new lexicon. Lexicon operations have
        /// eventual consistency, therefore, it might take some time before the lexicon is available
        /// to the SynthesizeSpeech operation.
        ///
        ///
        /// <para>
        /// For more information, see <a href="http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing
        /// Lexicons</a>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the PutLexicon service method.</param>
        ///
        /// <returns>The response from the PutLexicon service method, as returned by Polly.</returns>
        /// <exception cref="Amazon.Polly.Model.InvalidLexiconException">
        /// Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled
        /// correctly, and then try again.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.LexiconSizeExceededException">
        /// The maximum size of the specified lexicon would be exceeded by this operation.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.MaxLexemeLengthExceededException">
        /// The maximum size of the lexeme would be exceeded by this operation.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.MaxLexiconsNumberExceededException">
        /// The maximum number of lexicons would be exceeded by this operation.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.ServiceFailureException">
        /// An unknown condition has caused a service failure.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.UnsupportedPlsAlphabetException">
        /// The alphabet specified by the lexicon is not a supported alphabet. Valid values are
        /// <code>x-sampa</code> and <code>ipa</code>.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.UnsupportedPlsLanguageException">
        /// The language specified in the lexicon is unsupported. For a list of supported languages,
        /// see <a href="http://docs.aws.amazon.com/polly/latest/dg/API_LexiconAttributes.html">Lexicon
        /// Attributes</a>.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/polly-2016-06-10/PutLexicon">REST API Reference for PutLexicon Operation</seealso>
        public PutLexiconResponse PutLexicon(PutLexiconRequest request)
        {
            var marshaller   = new PutLexiconRequestMarshaller();
            var unmarshaller = PutLexiconResponseUnmarshaller.Instance;

            return(Invoke <PutLexiconRequest, PutLexiconResponse>(request, marshaller, unmarshaller));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutLexicon operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the PutLexicon operation on AmazonPollyClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutLexicon
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/polly-2016-06-10/PutLexicon">REST API Reference for PutLexicon Operation</seealso>
        public IAsyncResult BeginPutLexicon(PutLexiconRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new PutLexiconRequestMarshaller();
            var unmarshaller = PutLexiconResponseUnmarshaller.Instance;

            return(BeginInvoke <PutLexiconRequest>(request, marshaller, unmarshaller,
                                                   callback, state));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutLexicon operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the PutLexicon operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/polly-2016-06-10/PutLexicon">REST API Reference for PutLexicon Operation</seealso>
        public virtual Task <PutLexiconResponse> PutLexiconAsync(PutLexiconRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new PutLexiconRequestMarshaller();
            var unmarshaller = PutLexiconResponseUnmarshaller.Instance;

            return(InvokeAsync <PutLexiconRequest, PutLexiconResponse>(request, marshaller,
                                                                       unmarshaller, cancellationToken));
        }
Exemplo n.º 5
0
        public void PutLexiconMarshallTest()
        {
            var operation = service_model.FindOperation("PutLexicon");

            var request = InstantiateClassGenerator.Execute<PutLexiconRequest>();
            var marshaller = new PutLexiconRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            RequestValidator.Validate("PutLexicon", request, internalRequest, service_model);            

            var webResponse = new WebResponseData
            {
                Headers = {
                    {"x-amzn-RequestId", Guid.NewGuid().ToString()},
                    {"x-amz-crc32","0"}
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();
            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString());
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = PutLexiconResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                as PutLexiconResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);               
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutLexicon operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutLexicon operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<PutLexiconResponse> PutLexiconAsync(PutLexiconRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutLexiconRequestMarshaller();
            var unmarshaller = PutLexiconResponseUnmarshaller.Instance;

            return InvokeAsync<PutLexiconRequest,PutLexiconResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Stores a pronunciation lexicon in an AWS Region. If a lexicon with the same name already
        /// exists in the region, it is overwritten by the new lexicon. Lexicon operations have
        /// eventual consistency, therefore, it might take some time before the lexicon is available
        /// to the SynthesizeSpeech operation.
        /// 
        ///  
        /// <para>
        /// For more information, see <a href="http://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing
        /// Lexicons</a>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the PutLexicon service method.</param>
        /// 
        /// <returns>The response from the PutLexicon service method, as returned by Polly.</returns>
        /// <exception cref="Amazon.Polly.Model.InvalidLexiconException">
        /// Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled
        /// correctly, and then try again.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.LexiconSizeExceededException">
        /// The maximum size of the specified lexicon would be exceeded by this operation.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.MaxLexemeLengthExceededException">
        /// The maximum size of the lexeme would be exceeded by this operation.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.MaxLexiconsNumberExceededException">
        /// The maximum number of lexicons would be exceeded by this operation.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.ServiceFailureException">
        /// An unknown condition has caused a service failure.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.UnsupportedPlsAlphabetException">
        /// The alphabet specified by the lexicon is not a supported alphabet. Valid values are
        /// <code>x-sampa</code> and <code>ipa</code>.
        /// </exception>
        /// <exception cref="Amazon.Polly.Model.UnsupportedPlsLanguageException">
        /// The language specified in the lexicon is unsupported. For a list of supported languages,
        /// see <a href="http://docs.aws.amazon.com/polly/latest/dg/API_LexiconAttributes.html">Lexicon
        /// Attributes</a>.
        /// </exception>
        public PutLexiconResponse PutLexicon(PutLexiconRequest request)
        {
            var marshaller = new PutLexiconRequestMarshaller();
            var unmarshaller = PutLexiconResponseUnmarshaller.Instance;

            return Invoke<PutLexiconRequest,PutLexiconResponse>(request, marshaller, unmarshaller);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutLexicon operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutLexicon operation on AmazonPollyClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutLexicon
        ///         operation.</returns>
        public IAsyncResult BeginPutLexicon(PutLexiconRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new PutLexiconRequestMarshaller();
            var unmarshaller = PutLexiconResponseUnmarshaller.Instance;

            return BeginInvoke<PutLexiconRequest>(request, marshaller, unmarshaller,
                callback, state);
        }