public void MutateCustomerExtensionSettings()
        {
            moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerExtensionSettingOperation(),
                },
            };
            MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse
            {
                Results =
                {
                    new MutateCustomerExtensionSettingResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerExtensionSettingServiceClient   client   = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerExtensionSettingsResponse response = client.MutateCustomerExtensionSettings(request.CustomerId, request.Operations);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task MutateCustomerExtensionSettingsAsync()
        {
            moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerExtensionSettingOperation(),
                },
            };
            MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse
            {
                Results =
                {
                    new MutateCustomerExtensionSettingResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettingsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateCustomerExtensionSettingsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CustomerExtensionSettingServiceClient   client = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerExtensionSettingsResponse responseCallSettings = await client.MutateCustomerExtensionSettingsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            MutateCustomerExtensionSettingsResponse responseCancellationToken = await client.MutateCustomerExtensionSettingsAsync(request.CustomerId, request.Operations, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
        public void MutateCustomerExtensionSettingsRequestObject()
        {
            moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerExtensionSettingOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse
            {
                Results =
                {
                    new MutateCustomerExtensionSettingResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerExtensionSettingServiceClient   client   = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerExtensionSettingsResponse response = client.MutateCustomerExtensionSettings(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for MutateCustomerExtensionSettings</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCustomerExtensionSettings()
 {
     // Create client
     CustomerExtensionSettingServiceClient customerExtensionSettingServiceClient = CustomerExtensionSettingServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     IEnumerable <CustomerExtensionSettingOperation> operations = new CustomerExtensionSettingOperation[]
     {
         new CustomerExtensionSettingOperation(),
     };
     // Make the request
     MutateCustomerExtensionSettingsResponse response = customerExtensionSettingServiceClient.MutateCustomerExtensionSettings(customerId, operations);
 }
Exemple #5
0
        /// <summary>
        /// Runs the code example.
        /// </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">ID of the campaign to targeting are added.</param>
        public void Run(GoogleAdsClient client, long customerId, long campaignId)
        {
            // Get the CustomerExtensionSettingServiceClient.
            CustomerExtensionSettingServiceClient customerExtensionSettingService =
                client.GetService(Services.V4.CustomerExtensionSettingService);

            try
            {
                // Creates an extension feed item as price.
                string extensionFeedItemResourceName =
                    CreateExtensionFeedItem(client, customerId, campaignId);

                // Creates a customer extension setting using the previously created extension
                // feed item. This associates the price extension to your account.
                CustomerExtensionSetting customerExtensionSetting =
                    new CustomerExtensionSetting()
                {
                    ExtensionType      = ExtensionType.Price,
                    ExtensionFeedItems = { extensionFeedItemResourceName }
                };

                // Creates an operation to add the extension setting.
                CustomerExtensionSettingOperation operation =
                    new CustomerExtensionSettingOperation()
                {
                    Create = customerExtensionSetting
                };

                // Issues a mutate request to add the customer extension setting
                // and prints its information.
                MutateCustomerExtensionSettingsResponse response =
                    customerExtensionSettingService.MutateCustomerExtensionSettings(
                        customerId.ToString(), new[] { operation });

                foreach (MutateCustomerExtensionSettingResult result in response.Results)
                {
                    Console.WriteLine("Created customer extension setting with resource name: " +
                                      result.ResourceName);
                }
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }
        /// <summary>Snippet for MutateCustomerExtensionSettingsAsync</summary>
        public async Task MutateCustomerExtensionSettingsAsync()
        {
            // Snippet: MutateCustomerExtensionSettingsAsync(string, IEnumerable<CustomerExtensionSettingOperation>, CallSettings)
            // Additional: MutateCustomerExtensionSettingsAsync(string, IEnumerable<CustomerExtensionSettingOperation>, CancellationToken)
            // Create client
            CustomerExtensionSettingServiceClient customerExtensionSettingServiceClient = await CustomerExtensionSettingServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            IEnumerable <CustomerExtensionSettingOperation> operations = new CustomerExtensionSettingOperation[]
            {
                new CustomerExtensionSettingOperation(),
            };
            // Make the request
            MutateCustomerExtensionSettingsResponse response = await customerExtensionSettingServiceClient.MutateCustomerExtensionSettingsAsync(customerId, operations);

            // End snippet
        }
 /// <summary>Snippet for MutateCustomerExtensionSettings</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCustomerExtensionSettingsRequestObject()
 {
     // Create client
     CustomerExtensionSettingServiceClient customerExtensionSettingServiceClient = CustomerExtensionSettingServiceClient.Create();
     // Initialize request argument(s)
     MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
     {
         CustomerId = "",
         Operations =
         {
             new CustomerExtensionSettingOperation(),
         },
         PartialFailure = false,
         ValidateOnly   = false,
     };
     // Make the request
     MutateCustomerExtensionSettingsResponse response = customerExtensionSettingServiceClient.MutateCustomerExtensionSettings(request);
 }
Exemple #8
0
        public async Task MutateCustomerExtensionSettingsAsync3()
        {
            Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(MockBehavior.Strict);
            MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettingsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCustomerExtensionSettingsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerExtensionSettingServiceClient   client   = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerExtensionSettingsResponse response = await client.MutateCustomerExtensionSettingsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #9
0
        public void MutateCustomerExtensionSettings3()
        {
            Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(MockBehavior.Strict);
            MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettings(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerExtensionSettingServiceClient   client   = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerExtensionSettingsResponse response = client.MutateCustomerExtensionSettings(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for MutateCustomerExtensionSettingsAsync</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 MutateCustomerExtensionSettingsRequestObjectAsync()
        {
            // Create client
            CustomerExtensionSettingServiceClient customerExtensionSettingServiceClient = await CustomerExtensionSettingServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId = "",
                Operations =
                {
                    new CustomerExtensionSettingOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = false,
                ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
            };
            // Make the request
            MutateCustomerExtensionSettingsResponse response = await customerExtensionSettingServiceClient.MutateCustomerExtensionSettingsAsync(request);
        }
Exemple #11
0
 /// <summary>Snippet for MutateCustomerExtensionSettings</summary>
 public void MutateCustomerExtensionSettingsRequestObject()
 {
     // Snippet: MutateCustomerExtensionSettings(MutateCustomerExtensionSettingsRequest, CallSettings)
     // Create client
     CustomerExtensionSettingServiceClient customerExtensionSettingServiceClient = CustomerExtensionSettingServiceClient.Create();
     // Initialize request argument(s)
     MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
     {
         CustomerId = "",
         Operations =
         {
             new CustomerExtensionSettingOperation(),
         },
         PartialFailure      = false,
         ValidateOnly        = false,
         ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified,
     };
     // Make the request
     MutateCustomerExtensionSettingsResponse response = customerExtensionSettingServiceClient.MutateCustomerExtensionSettings(request);
     // End snippet
 }
        /// <summary>Snippet for MutateCustomerExtensionSettingsAsync</summary>
        public async Task MutateCustomerExtensionSettingsRequestObjectAsync()
        {
            // Snippet: MutateCustomerExtensionSettingsAsync(MutateCustomerExtensionSettingsRequest, CallSettings)
            // Additional: MutateCustomerExtensionSettingsAsync(MutateCustomerExtensionSettingsRequest, CancellationToken)
            // Create client
            CustomerExtensionSettingServiceClient customerExtensionSettingServiceClient = await CustomerExtensionSettingServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId = "",
                Operations =
                {
                    new CustomerExtensionSettingOperation(),
                },
                PartialFailure = false,
                ValidateOnly   = false,
            };
            // Make the request
            MutateCustomerExtensionSettingsResponse response = await customerExtensionSettingServiceClient.MutateCustomerExtensionSettingsAsync(request);

            // End snippet
        }
Exemple #13
0
        public async Task MutateCustomerExtensionSettingsAsync()
        {
            Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(MockBehavior.Strict);
            MutateCustomerExtensionSettingsRequest expectedRequest = new MutateCustomerExtensionSettingsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettingsAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCustomerExtensionSettingsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerExtensionSettingServiceClient client = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            IEnumerable <CustomerExtensionSettingOperation> operations = new List <CustomerExtensionSettingOperation>();
            bool partialFailure = true;
            bool validateOnly   = false;
            MutateCustomerExtensionSettingsResponse response = await client.MutateCustomerExtensionSettingsAsync(customerId, operations, partialFailure, validateOnly);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }