public void GenerateProductMixIdeas() { moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict); GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "customer_id3b3724cb", PlannableLocationId = "plannable_location_idbae428fa", CurrencyCode = "currency_code7f81e352", BudgetMicros = 6302061979031921068L, }; GenerateProductMixIdeasResponse expectedResponse = new GenerateProductMixIdeasResponse { ProductAllocation = { new ProductAllocation(), }, }; mockGrpcClient.Setup(x => x.GenerateProductMixIdeas(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateProductMixIdeasResponse response = client.GenerateProductMixIdeas(request.CustomerId, request.PlannableLocationId, request.CurrencyCode, request.BudgetMicros); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GenerateProductMixIdeasAsync() { moq::Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new moq::Mock <ReachPlanService.ReachPlanServiceClient>(moq::MockBehavior.Strict); GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "customer_id3b3724cb", PlannableLocationId = "plannable_location_idbae428fa", CurrencyCode = "currency_code7f81e352", BudgetMicros = 6302061979031921068L, }; GenerateProductMixIdeasResponse expectedResponse = new GenerateProductMixIdeasResponse { ProductAllocation = { new ProductAllocation(), }, }; mockGrpcClient.Setup(x => x.GenerateProductMixIdeasAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GenerateProductMixIdeasResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateProductMixIdeasResponse responseCallSettings = await client.GenerateProductMixIdeasAsync(request.CustomerId, request.PlannableLocationId, request.CurrencyCode, request.BudgetMicros, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); GenerateProductMixIdeasResponse responseCancellationToken = await client.GenerateProductMixIdeasAsync(request.CustomerId, request.PlannableLocationId, request.CurrencyCode, request.BudgetMicros, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Generates a product mix ideas given a set of preferences. This method /// helps the advertiser to obtain a good mix of ad formats and budget /// allocations based on its preferences. /// </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> /// The RPC response. /// </returns> public override GenerateProductMixIdeasResponse GenerateProductMixIdeas( GenerateProductMixIdeasRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GenerateProductMixIdeasRequest(ref request, ref callSettings); return(_callGenerateProductMixIdeas.Sync(request, callSettings)); }
/// <summary>Snippet for GenerateProductMixIdeas</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GenerateProductMixIdeasRequestObject() { // Create client ReachPlanServiceClient reachPlanServiceClient = ReachPlanServiceClient.Create(); // Initialize request argument(s) GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "", Preferences = new Preferences(), PlannableLocationId = "", CurrencyCode = "", BudgetMicros = 0L, }; // Make the request GenerateProductMixIdeasResponse response = reachPlanServiceClient.GenerateProductMixIdeas(request); }
/// <summary> /// Pulls a forecast for a product mix suggested based on preferences for whether the ad /// would have a guaranteed price, play with sound, would be skippable, would include top /// content, and a desired ad length. /// </summary> /// <param name="reachPlanService">Instance of Reach Plan Service client.</param> /// <param name="customerId">The customer ID for the reach forecast.</param> /// <param name="locationId">Location ID to plan for. To find a valid locaction ID, either /// see https://developers.google.com/adwords/api/docs/appendix/geotargeting or call /// <see cref="ReachPlanServiceClient.ListPlannableLocations"/>.</param> /// <param name="currencyCode">Three-character ISO 4217 currency code.</param> /// <param name="budgetMicros">Budget in currency micro-units to plan for.</param> public void ForecastSuggestedMix( ReachPlanServiceClient reachPlanService, string customerId, string locationId, string currencyCode, long budgetMicros) { // Note: If preferences are too restrictive, then the response will be empty. Preferences preferences = new Preferences() { HasGuaranteedPrice = true, StartsWithSound = true, IsSkippable = false, TopContentOnly = true, AdLength = ReachPlanAdLength.FifteenOrTwentySeconds }; GenerateProductMixIdeasRequest mixRequest = new GenerateProductMixIdeasRequest() { BudgetMicros = Convert.ToInt64((double)budgetMicros), CurrencyCode = currencyCode, CustomerId = customerId, PlannableLocationId = locationId, Preferences = preferences }; GenerateProductMixIdeasResponse mixResponse = reachPlanService.GenerateProductMixIdeas(mixRequest); List <PlannedProduct> productMix = new List <PlannedProduct>(); foreach (ProductAllocation product in mixResponse.ProductAllocation) { productMix.Add( new PlannedProduct() { PlannableProductCode = product.PlannableProductCode, BudgetMicros = product.BudgetMicros }); } GenerateReachForecastRequest curveRequest = BuildReachRequest(customerId, productMix, locationId, currencyCode); PullReachCurve(reachPlanService, curveRequest); }
/// <summary>Snippet for GenerateProductMixIdeasAsync</summary> public async Task GenerateProductMixIdeasRequestObjectAsync() { // Snippet: GenerateProductMixIdeasAsync(GenerateProductMixIdeasRequest, CallSettings) // Additional: GenerateProductMixIdeasAsync(GenerateProductMixIdeasRequest, CancellationToken) // Create client ReachPlanServiceClient reachPlanServiceClient = await ReachPlanServiceClient.CreateAsync(); // Initialize request argument(s) GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "", Preferences = new Preferences(), PlannableLocationId = "", CurrencyCode = "", BudgetMicros = 0L, }; // Make the request GenerateProductMixIdeasResponse response = await reachPlanServiceClient.GenerateProductMixIdeasAsync(request); // End snippet }
public async Task GenerateProductMixIdeasAsync() { Mock <ReachPlanService.ReachPlanServiceClient> mockGrpcClient = new Mock <ReachPlanService.ReachPlanServiceClient>(MockBehavior.Strict); GenerateProductMixIdeasRequest request = new GenerateProductMixIdeasRequest { CustomerId = "customerId-1772061412", PlannableLocationId = null, CurrencyCode = null, BudgetMicros = null, Preferences = new Preferences(), }; GenerateProductMixIdeasResponse expectedResponse = new GenerateProductMixIdeasResponse(); mockGrpcClient.Setup(x => x.GenerateProductMixIdeasAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <GenerateProductMixIdeasResponse>(Task.FromResult(expectedResponse), null, null, null, null)); ReachPlanServiceClient client = new ReachPlanServiceClientImpl(mockGrpcClient.Object, null); GenerateProductMixIdeasResponse response = await client.GenerateProductMixIdeasAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
partial void Modify_GenerateProductMixIdeasRequest(ref GenerateProductMixIdeasRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Generates a product mix ideas given a set of preferences. This method /// helps the advertiser to obtain a good mix of ad formats and budget /// allocations based on its preferences. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <GenerateProductMixIdeasResponse> GenerateProductMixIdeasAsync(GenerateProductMixIdeasRequest request, st::CancellationToken cancellationToken) => GenerateProductMixIdeasAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Generates a product mix ideas given a set of preferences. This method /// helps the advertiser to obtain a good mix of ad formats and budget /// allocations based on its preferences. /// </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 Task containing the RPC response.</returns> public virtual stt::Task <GenerateProductMixIdeasResponse> GenerateProductMixIdeasAsync(GenerateProductMixIdeasRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Generates a product mix ideas given a set of preferences. This method /// helps the advertiser to obtain a good mix of ad formats and budget /// allocations based on its preferences. /// </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> /// The RPC response. /// </returns> public virtual GenerateProductMixIdeasResponse GenerateProductMixIdeas( GenerateProductMixIdeasRequest request, gaxgrpc::CallSettings callSettings = null) { throw new sys::NotImplementedException(); }