/// <summary>
 /// Updates status or removes a Merchant Center link.
 /// </summary>
 /// <param name="customerId">
 /// Required. The ID of the customer being modified.
 /// </param>
 /// <param name="operation">
 /// Required. The operation to perform on the link
 /// </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 <MutateMerchantCenterLinkResponse> MutateMerchantCenterLinkAsync(
     string customerId,
     MerchantCenterLinkOperation operation,
     st::CancellationToken cancellationToken) => MutateMerchantCenterLinkAsync(
     customerId,
     operation,
     gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
        /// <summary>
        /// Updates the status of a Merchant Center link request for a given resource name.
        /// </summary>
        /// <param name="customerId">The customer identifier.</param>
        /// <param name="merchantCenterLinkService">The merchant center link service.</param>
        /// <param name="merchantCenterLink">The merchant center link.</param>
        /// <param name="status"></param>
        private static void UpdateMerchantCenterLinkStatus(long customerId,
                                                           MerchantCenterLinkServiceClient merchantCenterLinkService,
                                                           MerchantCenterLink merchantCenterLink, MerchantCenterLinkStatus status)
        {
            // Enables the pending link.
            MerchantCenterLink linkToUpdate = new MerchantCenterLink()
            {
                ResourceName = merchantCenterLink.ResourceName,
                Status       = status
            };

            // Creates an operation.
            MerchantCenterLinkOperation operation = new MerchantCenterLinkOperation()
            {
                Update     = linkToUpdate,
                UpdateMask = FieldMasks.AllSetFieldsOf(linkToUpdate)
            };

            // Updates the link.
            MutateMerchantCenterLinkResponse mutateResponse =
                merchantCenterLinkService.MutateMerchantCenterLink(
                    customerId.ToString(), operation);

            // Displays the result.
            Console.WriteLine($"The status of Merchant Center Link with resource name " +
                              $"'{mutateResponse.Result.ResourceName}' to Google Ads account : " +
                              $"{customerId} was updated to {status}.");
        }
예제 #3
0
 /// <summary>Snippet for MutateMerchantCenterLink</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateMerchantCenterLink()
 {
     // Create client
     MerchantCenterLinkServiceClient merchantCenterLinkServiceClient = MerchantCenterLinkServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     MerchantCenterLinkOperation operation = new MerchantCenterLinkOperation();
     // Make the request
     MutateMerchantCenterLinkResponse response = merchantCenterLinkServiceClient.MutateMerchantCenterLink(customerId, operation);
 }
 /// <summary>
 /// Updates status or removes a Merchant Center link.
 /// </summary>
 /// <param name="customerId">
 /// Required. The ID of the customer being modified.
 /// </param>
 /// <param name="operation">
 /// Required. The operation to perform on the link
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual MutateMerchantCenterLinkResponse MutateMerchantCenterLink(
     string customerId,
     MerchantCenterLinkOperation operation,
     gaxgrpc::CallSettings callSettings = null) => MutateMerchantCenterLink(
     new MutateMerchantCenterLinkRequest
 {
     CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)),
     Operation  = gax::GaxPreconditions.CheckNotNull(operation, nameof(operation)),
 },
     callSettings);
        /// <summary>Snippet for MutateMerchantCenterLinkAsync</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 MutateMerchantCenterLinkAsync()
        {
            // Create client
            MerchantCenterLinkServiceClient merchantCenterLinkServiceClient = await MerchantCenterLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            MerchantCenterLinkOperation operation = new MerchantCenterLinkOperation();
            // Make the request
            MutateMerchantCenterLinkResponse response = await merchantCenterLinkServiceClient.MutateMerchantCenterLinkAsync(customerId, operation);
        }
예제 #6
0
        /// <summary>Snippet for MutateMerchantCenterLinkAsync</summary>
        public async Task MutateMerchantCenterLinkAsync()
        {
            // Snippet: MutateMerchantCenterLinkAsync(string, MerchantCenterLinkOperation, CallSettings)
            // Additional: MutateMerchantCenterLinkAsync(string, MerchantCenterLinkOperation, CancellationToken)
            // Create client
            MerchantCenterLinkServiceClient merchantCenterLinkServiceClient = await MerchantCenterLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            MerchantCenterLinkOperation operation = new MerchantCenterLinkOperation();
            // Make the request
            MutateMerchantCenterLinkResponse response = await merchantCenterLinkServiceClient.MutateMerchantCenterLinkAsync(customerId, operation);

            // End snippet
        }
        /// <summary>
        /// Removes a Merchant Center link from a Google Ads client customer account.
        /// </summary>
        /// <param name="merchantCenterLinkServiceClient">The MerchantCenterLinkService
        ///     client.</param>
        /// <param name="customerId">The client customer ID of the Google Ads account that has the
        ///     link request.</param>
        /// <param name="merchantCenterLink">The MerchantCenterLink object to remove.</param>
        private void RemoveMerchantCenterLink(
            MerchantCenterLinkServiceClient merchantCenterLinkServiceClient,
            long customerId, MerchantCenterLink merchantCenterLink)
        {
            // Creates a single remove operation, specifying the Merchant Center link resource name.
            MerchantCenterLinkOperation operation = new MerchantCenterLinkOperation
            {
                Remove = merchantCenterLink.ResourceName
            };

            // Sends the operation in a mutate request.
            MutateMerchantCenterLinkResponse response =
                merchantCenterLinkServiceClient.MutateMerchantCenterLink(
                    customerId.ToString(), operation);

            Console.WriteLine("Removed Merchant Center Link with resource name: " +
                              $"{response.Result.ResourceName}");
        }
예제 #8
0
        public async Task MutateMerchantCenterLinkAsync()
        {
            Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient>(MockBehavior.Strict);
            MutateMerchantCenterLinkRequest expectedRequest = new MutateMerchantCenterLinkRequest
            {
                CustomerId = "customerId-1772061412",
                Operation  = new MerchantCenterLinkOperation(),
            };
            MutateMerchantCenterLinkResponse expectedResponse = new MutateMerchantCenterLinkResponse();

            mockGrpcClient.Setup(x => x.MutateMerchantCenterLinkAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateMerchantCenterLinkResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            MerchantCenterLinkServiceClient client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            MerchantCenterLinkOperation      operation = new MerchantCenterLinkOperation();
            MutateMerchantCenterLinkResponse response  = await client.MutateMerchantCenterLinkAsync(customerId, operation);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #9
0
        public void MutateMerchantCenterLink()
        {
            Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient>(MockBehavior.Strict);
            MutateMerchantCenterLinkRequest expectedRequest = new MutateMerchantCenterLinkRequest
            {
                CustomerId = "customerId-1772061412",
                Operation  = new MerchantCenterLinkOperation(),
            };
            MutateMerchantCenterLinkResponse expectedResponse = new MutateMerchantCenterLinkResponse();

            mockGrpcClient.Setup(x => x.MutateMerchantCenterLink(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            MerchantCenterLinkServiceClient client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            MerchantCenterLinkOperation      operation = new MerchantCenterLinkOperation();
            MutateMerchantCenterLinkResponse response  = client.MutateMerchantCenterLink(customerId, operation);

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