/// <summary>Snippet for GetFeedAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetFeedRequestObjectAsync() { // Create client FeedServiceClient feedServiceClient = await FeedServiceClient.CreateAsync(); // Initialize request argument(s) GetFeedRequest request = new GetFeedRequest { ResourceNameAsFeedName = FeedName.FromCustomerFeed("[CUSTOMER]", "[FEED]"), }; // Make the request Feed response = await feedServiceClient.GetFeedAsync(request); }
/// <summary>Snippet for DeleteFeedAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task DeleteFeedRequestObjectAsync() { // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) DeleteFeedRequest request = new DeleteFeedRequest { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), }; // Make the request await assetServiceClient.DeleteFeedAsync(request); }
/// <summary>Snippet for GetFeed</summary> public void GetFeedRequestObject() { // Snippet: GetFeed(GetFeedRequest, CallSettings) // Create client AssetServiceClient assetServiceClient = AssetServiceClient.Create(); // Initialize request argument(s) GetFeedRequest request = new GetFeedRequest { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), }; // Make the request Feed response = assetServiceClient.GetFeed(request); // End snippet }
/// <summary>Snippet for DeleteFeedAsync</summary> public async Task DeleteFeedResourceNamesAsync() { // Snippet: DeleteFeedAsync(FeedName, CallSettings) // Additional: DeleteFeedAsync(FeedName, CancellationToken) // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) FeedName name = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"); // Make the request await assetServiceClient.DeleteFeedAsync(name); // End snippet }
/// <summary>Snippet for GetFeed</summary> public void GetFeedRequestObject() { // Snippet: GetFeed(GetFeedRequest, CallSettings) // Create client FeedServiceClient feedServiceClient = FeedServiceClient.Create(); // Initialize request argument(s) GetFeedRequest request = new GetFeedRequest { ResourceNameAsFeedName = FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"), }; // Make the request Feed response = feedServiceClient.GetFeed(request); // End snippet }
/// <summary>Snippet for GetFeedAsync</summary> public async Task GetFeedResourceNamesAsync() { // Snippet: GetFeedAsync(FeedName, CallSettings) // Additional: GetFeedAsync(FeedName, CancellationToken) // Create client FeedServiceClient feedServiceClient = await FeedServiceClient.CreateAsync(); // Initialize request argument(s) FeedName resourceName = FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"); // Make the request Feed response = await feedServiceClient.GetFeedAsync(resourceName); // End snippet }
/// <summary>Snippet for DeleteFeedAsync</summary> public async Task DeleteFeedAsync() { // Snippet: DeleteFeedAsync(string,CallSettings) // Additional: DeleteFeedAsync(string,CancellationToken) // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) string formattedName = new FeedName("[PROJECT]", "[FEED]").ToString(); // Make the request await assetServiceClient.DeleteFeedAsync(formattedName); // End snippet }
void ReleaseDesignerOutlets() { if (Backward != null) { Backward.Dispose(); Backward = null; } if (DateInput != null) { DateInput.Dispose(); DateInput = null; } if (FeedName != null) { FeedName.Dispose(); FeedName = null; } if (FeedSelection != null) { FeedSelection.Dispose(); FeedSelection = null; } if (Forward != null) { Forward.Dispose(); Forward = null; } if (NoContent != null) { NoContent.Dispose(); NoContent = null; } if (NoMenu != null) { NoMenu.Dispose(); NoMenu = null; } if (WebView != null) { WebView.Dispose(); WebView = null; } }
/// <summary>Snippet for DeleteFeedAsync</summary> public async Task DeleteFeedRequestObjectAsync() { // Snippet: DeleteFeedAsync(DeleteFeedRequest, CallSettings) // Additional: DeleteFeedAsync(DeleteFeedRequest, CancellationToken) // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) DeleteFeedRequest request = new DeleteFeedRequest { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), }; // Make the request await assetServiceClient.DeleteFeedAsync(request); // End snippet }
public async Task <FeedName[]> Read() { var result = await FeedReader.ReadAsync("https://www.delfi.lt/rss/feeds/index.xml").ConfigureAwait(false); var feeds = new List <FeedName>(); foreach (var item in result.Items) { var feed = new FeedName(); feed.Category = Path.GetFileNameWithoutExtension(item.Link); feed.Url = item.Link; feeds.Add(feed); } return(feeds.ToArray()); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <ApplicationConfiguration>().As <IApplicationConfiguration>(); builder.RegisterType <AlphaAuthentication>().As <IAuthentication>(); builder.RegisterType <AlphaCommentsReader>().As <ICommentsReader>(); builder.RegisterType <AlphaArticleTextReader>().As <IArticleTextReader>(); builder.RegisterType <AlphaDefinitionTransformer>().As <IDefinitionTransformer>(); builder.Register(ctx => new ArticlesPersistency(ctx.Resolve <ILogger <ArticlesPersistency> >(), saveLocation)).As <IArticlesPersistency>(); foreach (var stock in stocks) { var feed = new FeedName(); feed.Url = $"https://seekingalpha.com/api/sa/combined/{stock}.xml"; feed.Category = stock; builder.RegisterInstance(feed); } }
public void DeleteFeedResourceNames() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); DeleteFeedRequest request = new DeleteFeedRequest { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteFeed(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); client.DeleteFeed(request.FeedName); mockGrpcClient.VerifyAll(); }
private void ButtonAddClick(object sender, RoutedEventArgs e) { FeedName = FeedName.Trim(); FeedUrl = FeedUrl.Trim(); this.ValidateFields(); Program.Dispatcher = this.Dispatcher; if (this.HasErrors) { return; } this.StartWait(); var feedName = FeedName; var feedUrl = FeedUrl; var task = new Task(() => Core.GameFeedManager.Get().AddFeed(feedName, feedUrl)); task.ContinueWith((continueTask) => { var error = ""; if (continueTask.IsFaulted) { if (continueTask.Exception != null) { error = continueTask.Exception.Message; } else { error = "Unable to add feed. Try again later."; } } this.Dispatcher.Invoke(new Action(() => { if (!string.IsNullOrWhiteSpace(error)) { this.SetError(error); } this.EndWait(); if (string.IsNullOrWhiteSpace(error)) { this.Close(DialogResult.OK); } })); }); task.Start(); }
public async Task DeleteFeedAsync() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); DeleteFeedRequest expectedRequest = new DeleteFeedRequest { Name = new FeedName("[PROJECT]", "[FEED]").ToString(), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteFeedAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); string formattedName = new FeedName("[PROJECT]", "[FEED]").ToString(); await client.DeleteFeedAsync(formattedName); mockGrpcClient.VerifyAll(); }
public void DeleteFeed() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); DeleteFeedRequest expectedRequest = new DeleteFeedRequest { Name = new FeedName("[PROJECT]", "[FEED]").ToString(), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteFeed(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); string formattedName = new FeedName("[PROJECT]", "[FEED]").ToString(); client.DeleteFeed(formattedName); mockGrpcClient.VerifyAll(); }
public async stt::Task DeleteFeedResourceNamesAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); DeleteFeedRequest request = new DeleteFeedRequest { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteFeedAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteFeedAsync(request.FeedName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteFeedAsync(request.FeedName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public async stt::Task CreateFeedRequestObjectAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CreateFeedRequest request = new CreateFeedRequest { Parent = "parent7858e4d0", FeedId = "feed_id938e5ac9", Feed = new Feed(), }; Feed expectedResponse = new Feed { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), AssetNames = { "asset_namese42cd316", }, AssetTypes = { "asset_types44c0f429", }, ContentType = ContentType.AccessPolicy, FeedOutputConfig = new FeedOutputConfig(), Condition = new gt::Expr(), RelationshipTypes = { "relationship_typesfb911a9b", }, }; mockGrpcClient.Setup(x => x.CreateFeedAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Feed>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); Feed responseCallSettings = await client.CreateFeedAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Feed responseCancellationToken = await client.CreateFeedAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task GetFeedAsync() { Mock <FeedService.FeedServiceClient> mockGrpcClient = new Mock <FeedService.FeedServiceClient>(MockBehavior.Strict); GetFeedRequest expectedRequest = new GetFeedRequest { ResourceName = new FeedName("[CUSTOMER]", "[FEED]").ToString(), }; Feed expectedResponse = new Feed { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetFeedAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Feed>(Task.FromResult(expectedResponse), null, null, null, null)); FeedServiceClient client = new FeedServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new FeedName("[CUSTOMER]", "[FEED]").ToString(); Feed response = await client.GetFeedAsync(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetFeed() { Mock <FeedService.FeedServiceClient> mockGrpcClient = new Mock <FeedService.FeedServiceClient>(MockBehavior.Strict); GetFeedRequest expectedRequest = new GetFeedRequest { ResourceName = new FeedName("[CUSTOMER]", "[FEED]").ToString(), }; Feed expectedResponse = new Feed { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetFeed(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); FeedServiceClient client = new FeedServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new FeedName("[CUSTOMER]", "[FEED]").ToString(); Feed response = client.GetFeed(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Creates the campaign feed. /// </summary> /// <param name="client">The Google Ads client.</param> /// <param name="customerId">The customer ID for which the call is made.</param> /// <param name="campaignId">The campaign ID for which the affiliate location extensions /// are added.</param> /// <param name="feedMapping">The affliate location extension feedmapping for /// <paramref name="feedResourceName"/></param> /// <param name="feedResourceName">The feed resource name.</param> /// <param name="chainId">The retail chain ID.</param> private static void CreateCampaignFeed(GoogleAdsClient client, long customerId, long campaignId, FeedMapping feedMapping, string feedResourceName, long chainId) { // Get the CampaignFeedService. CampaignFeedServiceClient campaignFeedService = client.GetService( Services.V5.CampaignFeedService); long attributeIdForChainId = GetAttributeIdForChainId(feedMapping); string feedId = FeedName.Parse(feedResourceName).FeedId; string matchingFunction = $"IN(FeedAttribute[{feedId}, {attributeIdForChainId}], {chainId})"; // Adds a CampaignFeed that associates the feed with this campaign for // the AFFILIATE_LOCATION placeholder type. CampaignFeed campaignFeed = new CampaignFeed() { Feed = feedResourceName, PlaceholderTypes = { PlaceholderType.AffiliateLocation }, MatchingFunction = new MatchingFunction() { FunctionString = matchingFunction }, Campaign = ResourceNames.Campaign(customerId, campaignId), }; CampaignFeedOperation operation = new CampaignFeedOperation() { Create = campaignFeed }; MutateCampaignFeedsResponse campaignFeedsResponse = campaignFeedService.MutateCampaignFeeds( customerId.ToString(), new[] { operation }); // Displays the result. string addedCampaignFeed = campaignFeedsResponse.Results[0].ResourceName; Console.WriteLine($"Campaign feed created with resource name: {addedCampaignFeed}."); return; }
public void UpdateFeedRequestObject() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); UpdateFeedRequest request = new UpdateFeedRequest { Feed = new Feed(), UpdateMask = new wkt::FieldMask(), }; Feed expectedResponse = new Feed { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), AssetNames = { "asset_namese42cd316", }, AssetTypes = { "asset_types44c0f429", }, ContentType = ContentType.AccessPolicy, FeedOutputConfig = new FeedOutputConfig(), Condition = new gt::Expr(), RelationshipTypes = { "relationship_typesfb911a9b", }, }; mockGrpcClient.Setup(x => x.UpdateFeed(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); Feed response = client.UpdateFeed(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetFeedAsync() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); GetFeedRequest expectedRequest = new GetFeedRequest { Name = new FeedName("[PROJECT]", "[FEED]").ToString(), }; Feed expectedResponse = new Feed { Name = "name2-1052831874", }; mockGrpcClient.Setup(x => x.GetFeedAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Feed>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); string formattedName = new FeedName("[PROJECT]", "[FEED]").ToString(); Feed response = await client.GetFeedAsync(formattedName); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
protected override void BeginProcessing() { _connection = new NewOctopusConnection().Invoke <OctopusConnection>().ToList()[0]; _feedNameList = FeedName?.ToList().ConvertAll(s => s.ToLower()); _urlList = URL?.ToList().ConvertAll(s => s.ToLower()); }