コード例 #1
0
        public void Suggest_SearchExceptionMarshallTest()
        {
            var operation = service_model.FindOperation("Suggest");

            var request         = InstantiateClassGenerator.Execute <SuggestRequest>();
            var marshaller      = new SuggestRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);

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

            var exception   = operation.Exceptions.First(e => e.Name.Equals("SearchException"));
            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       },
                    { "x-amzn-ErrorType", "SearchException"         },
                }
            };

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

            webResponse.Headers["Content-Length"] = UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString();
            var context  = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), true, webResponse, true);
            var response = SuggestResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK);

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
コード例 #2
0
        public void SuggestMarshallTest()
        {
            var operation = service_model.FindOperation("Suggest");

            var request = InstantiateClassGenerator.Execute<SuggestRequest>();
            var marshaller = new SuggestRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            RequestValidator.Validate("Suggest", 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 = SuggestResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                as SuggestResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);               
        }
コード例 #3
0
        public void SuggestMarshallTest()
        {
            var operation = service_model.FindOperation("Suggest");

            var request    = InstantiateClassGenerator.Execute <SuggestRequest>();
            var marshaller = new SuggestRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("Suggest", 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 = SuggestResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as SuggestResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
コード例 #4
0
        /// <summary>
        /// Retrieves autocomplete suggestions for a partial query string. You can use suggestions
        /// enable you to display likely matches before users finish typing. In Amazon CloudSearch,
        /// suggestions are based on the contents of a particular text field. When you request
        /// suggestions, Amazon CloudSearch finds all of the documents whose values in the suggester
        /// field start with the specified query string. The beginning of the field must match
        /// the query string to be considered a match.
        ///
        ///
        /// <para>
        /// For more information about configuring suggesters and retrieving suggestions, see
        /// <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/getting-suggestions.html">Getting
        /// Suggestions</a> in the <i>Amazon CloudSearch Developer Guide</i>.
        /// </para>
        ///
        /// <para>
        /// The endpoint for submitting <code>Suggest</code> requests is domain-specific. You
        /// submit suggest requests to a domain's search endpoint. To get the search endpoint
        /// for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code>
        /// action. A domain's endpoints are also displayed on the domain dashboard in the Amazon
        /// CloudSearch console.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the Suggest service method.</param>
        ///
        /// <returns>The response from the Suggest service method, as returned by CloudSearchDomain.</returns>
        /// <exception cref="Amazon.CloudSearchDomain.Model.SearchException">
        /// Information about any problems encountered while processing a search request.
        /// </exception>
        public virtual SuggestResponse Suggest(SuggestRequest request)
        {
            var marshaller   = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return(Invoke <SuggestRequest, SuggestResponse>(request, marshaller, unmarshaller));
        }
コード例 #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the Suggest operation.
        /// <seealso cref="Amazon.CloudSearchDomain.IAmazonCloudSearchDomain"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Suggest 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 <SuggestResponse> SuggestAsync(SuggestRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return(Invoke <IRequest, SuggestRequest, SuggestResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
コード例 #6
0
        IAsyncResult invokeSuggest(SuggestRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller   = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return(Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer));
        }
コード例 #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the Suggest operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Suggest operation on AmazonCloudSearchDomainClient.</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 EndSuggest
        ///         operation.</returns>
        public virtual IAsyncResult BeginSuggest(SuggestRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return(BeginInvoke <SuggestRequest>(request, marshaller, unmarshaller,
                                                callback, state));
        }
コード例 #8
0
        /// <summary>
        /// Initiates the asynchronous execution of the Suggest operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Suggest 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 virtual Task <SuggestResponse> SuggestAsync(SuggestRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return(InvokeAsync <SuggestRequest, SuggestResponse>(request, marshaller,
                                                                 unmarshaller, cancellationToken));
        }
コード例 #9
0
        /// <summary>
        /// Initiates the asynchronous execution of the Suggest operation.
        /// <seealso cref="Amazon.CloudSearchDomain.IAmazonCloudSearchDomain"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the Suggest 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<SuggestResponse> SuggestAsync(SuggestRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return InvokeAsync<SuggestRequest,SuggestResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #10
0
        /// <summary>
        /// Retrieves autocomplete suggestions for a partial query string. You can use suggestions
        /// enable you to display likely matches before users finish typing. In Amazon CloudSearch,
        /// suggestions are based on the contents of a particular text field. When you request
        /// suggestions, Amazon CloudSearch finds all of the documents whose values in the suggester
        /// field start with the specified query string. The beginning of the field must match
        /// the query string to be considered a match. 
        /// 
        ///  
        /// <para>
        /// For more information about configuring suggesters and retrieving suggestions, see
        /// <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/getting-suggestions.html">Getting
        /// Suggestions</a> in the <i>Amazon CloudSearch Developer Guide</i>. 
        /// </para>
        ///  
        /// <para>
        /// The endpoint for submitting <code>Suggest</code> requests is domain-specific. You
        /// submit suggest requests to a domain's search endpoint. To get the search endpoint
        /// for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code>
        /// action. A domain's endpoints are also displayed on the domain dashboard in the Amazon
        /// CloudSearch console. 
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the Suggest service method.</param>
        /// 
        /// <returns>The response from the Suggest service method, as returned by CloudSearchDomain.</returns>
        /// <exception cref="SearchException">
        /// Information about any problems encountered while processing a search request.
        /// </exception>
        public SuggestResponse Suggest(SuggestRequest request)
        {
            var marshaller = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return Invoke<SuggestRequest,SuggestResponse>(request, marshaller, unmarshaller);
        }
コード例 #11
0
        /// <summary>
        /// Initiates the asynchronous execution of the Suggest operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the Suggest operation on AmazonCloudSearchDomainClient.</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 EndSuggest
        ///         operation.</returns>
        public IAsyncResult BeginSuggest(SuggestRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return BeginInvoke<SuggestRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
コード例 #12
0
        IAsyncResult invokeSuggest(SuggestRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new SuggestRequestMarshaller();
            var unmarshaller = SuggestResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }