Пример #1
0
 public Task<ProductListResponse> SearchProductsAsync(SearchProductsRequest searchProductsRequest)
 {
     var queryParam = RequestQueryParamsBuilder.BuildQueryParam(searchProductsRequest);
     var path = "/craftlink/v1/products" + queryParam;
     return AsyncRestClient.Get<ProductListResponse>(RequestOptions.BaseUrl + path,
         CreateHeaders(path, RequestOptions));
 }
Пример #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonServiceCatalogConfig config = new AmazonServiceCatalogConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonServiceCatalogClient client = new AmazonServiceCatalogClient(creds, config);

            SearchProductsResponse resp = new SearchProductsResponse();

            do
            {
                SearchProductsRequest req = new SearchProductsRequest
                {
                    PageToken = resp.NextPageToken
                    ,
                    PageSize = maxItems
                };

                resp = client.SearchProducts(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.ProductViewSummaries)
                {
                    AddObject(obj);
                }

                foreach (var obj in resp.ProductViewAggregations)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextPageToken));
        }
        /// <summary>
        /// Returns a paginated list all of the <code>Products</code> objects to which the caller
        /// has access.
        ///
        ///
        /// <para>
        /// The output of this operation can be used as input for other operations, such as <a>DescribeProductView</a>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SearchProducts service method.</param>
        ///
        /// <returns>The response from the SearchProducts service method, as returned by ServiceCatalog.</returns>
        /// <exception cref="Amazon.ServiceCatalog.Model.InvalidParametersException">
        /// One or more parameters provided to the operation are invalid.
        /// </exception>
        public SearchProductsResponse SearchProducts(SearchProductsRequest request)
        {
            var marshaller   = new SearchProductsRequestMarshaller();
            var unmarshaller = SearchProductsResponseUnmarshaller.Instance;

            return(Invoke <SearchProductsRequest, SearchProductsResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the SearchProducts operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SearchProducts operation on AmazonServiceCatalogClient.</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 EndSearchProducts
        ///         operation.</returns>
        public IAsyncResult BeginSearchProducts(SearchProductsRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new SearchProductsRequestMarshaller();
            var unmarshaller = SearchProductsResponseUnmarshaller.Instance;

            return(BeginInvoke <SearchProductsRequest>(request, marshaller, unmarshaller,
                                                       callback, state));
        }
Пример #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the SearchProducts operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SearchProducts 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 <SearchProductsResponse> SearchProductsAsync(SearchProductsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SearchProductsRequestMarshaller();
            var unmarshaller = SearchProductsResponseUnmarshaller.Instance;

            return(InvokeAsync <SearchProductsRequest, SearchProductsResponse>(request, marshaller,
                                                                               unmarshaller, cancellationToken));
        }
Пример #6
0
        public IActionResult SearchProducts(int pageNum, int pageSize, SearchProductsRequest searchRequest)
        {
            bool dateParsed = DateParser.ParseDate(searchRequest.SellStartDate, out DateTime datePassed);
            IQueryable <Product> searchResult = productAppService.SearchProducts(
                searchRequest.Name, dateParsed ? datePassed as DateTime? : null, searchRequest.DescriptionKeyWords);

            if (searchResult == null)
            {
                return(NotFound());
            }
            return(Ok(searchResult.OrderBy(m => m.SellStartDate).ToPagedList(pageNum, pageSize).Select(m => new { m.Name, m.SellStartDate })));
        }
        public void Search_Products()
        {
            SearchProductsRequest request = new SearchProductsRequest
            {
                Name     = "A new Product",
                Channel  = "API",
                Currency = Currency.TRY
            };

            ProductListResponse productListResponse = _craftgateClient.PayByLink().SearchProducts(request);

            Assert.NotNull(productListResponse);
        }
        /// <summary>Snippet for SearchProductsAsync</summary>
        public async Task SearchProductsRequestObjectAsync()
        {
            // Snippet: SearchProductsAsync(SearchProductsRequest, CallSettings)
            // Create client
            PrivateCatalogClient privateCatalogClient = await PrivateCatalogClient.CreateAsync();

            // Initialize request argument(s)
            SearchProductsRequest request = new SearchProductsRequest
            {
                Resource = "",
                Query    = "",
            };
            // Make the request
            PagedAsyncEnumerable <SearchProductsResponse, Product> response = privateCatalogClient.SearchProductsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Product item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((SearchProductsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Product item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int            pageSize   = 10;
            Page <Product> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Product item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Пример #9
0
 /// <summary>
 /// Search [Product][google.cloud.privatecatalog.v1beta1.Product] resources that consumers have access to, within the
 /// scope of the consumer cloud resource hierarchy context.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="Product"/> resources.</returns>
 public override gax::PagedAsyncEnumerable <SearchProductsResponse, Product> SearchProductsAsync(SearchProductsRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_SearchProductsRequest(ref request, ref callSettings);
     return(new gaxgrpc::GrpcPagedAsyncEnumerable <SearchProductsRequest, SearchProductsResponse, Product>(_callSearchProducts, request, callSettings));
 }
Пример #10
0
 partial void Modify_SearchProductsRequest(ref SearchProductsRequest request, ref gaxgrpc::CallSettings settings);
Пример #11
0
 /// <summary>
 /// Search [Product][google.cloud.privatecatalog.v1beta1.Product] resources that consumers have access to, within the
 /// scope of the consumer cloud resource hierarchy context.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="Product"/> resources.</returns>
 public virtual gax::PagedAsyncEnumerable <SearchProductsResponse, Product> SearchProductsAsync(SearchProductsRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();