public static BrowseClient CreateBrowseClient(this CommerceClients source, string serviceUrl) { var connectionString = serviceUrl; var subscriptionKey = ConfigurationManager.AppSettings["vc-marketplace-apikey"]; var client = new BrowseClient(new Uri(connectionString), new AzureSubscriptionMessageProcessingHandler(subscriptionKey, "secret")); return client; }
/// <summary> /// Browse folders /// </summary> static async Task <List <FileEntry> > BrowseFilesAsync(SocketAddress proxy, string folder, int period, bool cache) { Console.WriteLine($"Listing {folder??"<root>"} ..."); var cts = new CancellationTokenSource(period); var files = new List <FileEntry>(); try { using (var browser = await BrowseClient.CreateDirectoryBrowserAsync( proxy, folder, cache, CancellationToken.None)) { cts.Token.ThrowIfCancellationRequested(); while (true) { try { cts.Token.ThrowIfCancellationRequested(); if (!await browser.MoveNextAsync(cts.Token)) { break; } Console.WriteLine($"{DateTime.Now}: File {browser.Current} on {browser.Current.Interface} "); files.Add(browser.Current); } catch (BrowseException e) { Console.WriteLine($"Browse error {e.Message}"); } } } } catch (OperationCanceledException) { } return(files); }
public async Task GetRecommendationGenres_UsesCorrectURL() { var api = new Mock <IAPIConnector>(); var client = new BrowseClient(api.Object); await client.GetRecommendationGenres(); api.Verify(a => a.Get <RecommendationGenresResponse>( It.Is <Uri>((uri) => uri.ToString().Contains("recommendations/available-genre-seeds")) )); }
private CommerceService() { this._listClient = ClientContext.Clients.CreateListClient(); this._browseClient = ClientContext.Clients.CreateBrowseClient(); this._storeClient = ClientContext.Clients.CreateStoreClient(); this._cartClient = ClientContext.Clients.CreateCartClient(); this._orderClient = ClientContext.Clients.CreateOrderClient(); this._priceClient = ClientContext.Clients.CreatePriceClient(); this._marketingClient = ClientContext.Clients.CreateMarketingClient(); this._themeClient = ClientContext.Clients.CreateThemeClient(); this._reviewsClient = ClientContext.Clients.CreateReviewsClient(); _themesCacheStoragePath = ConfigurationManager.AppSettings["ThemeCacheFolder"]; this._viewLocator = new FileThemeViewLocator(_themesCacheStoragePath); this._cartHelper = new CartHelper(this); }
public CommerceService() { this._listClient = ClientContext.Clients.CreateListClient(); this._browseClient = ClientContext.Clients.CreateBrowseClient(); this._storeClient = ClientContext.Clients.CreateStoreClient(); this._cartClient = ClientContext.Clients.CreateCartClient(); this._orderClient = ClientContext.Clients.CreateOrderClient(); this._securityClient = ClientContext.Clients.CreateSecurityClient(); this._priceClient = ClientContext.Clients.CreatePriceClient(); this._marketingClient = ClientContext.Clients.CreateMarketingClient(); this._inventoryClient = ClientContext.Clients.CreateInventoryClient(); this._themeClient = ClientContext.Clients.CreateThemeClient(); this._pageClient = ClientContext.Clients.CreatePageClient(); this._reviewsClient = ClientContext.Clients.CreateReviewsClient(); _themesCacheStoragePath = ConfigurationManager.AppSettings["ThemeCacheFolder"]; _pagesCacheStoragePath = ConfigurationManager.AppSettings["PageCacheFolder"]; this._viewLocator = new FileThemeViewLocator(HostingEnvironment.MapPath(_themesCacheStoragePath)); this._cartHelper = new CartHelper(this); }
public static BrowseClient CreateBrowseClientWithUri(this CommerceClients source, string serviceUrl) { var client = new BrowseClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler()); return(client); }
public static BrowseClient CreateBrowseClientWithUri(this CommerceClients source, string serviceUrl) { var client = new BrowseClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler()); return client; }