/// <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}.");
        }
Exemplo n.º 2
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);
 }
Exemplo n.º 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 MutateMerchantCenterLinkRequestObject()
 {
     // Create client
     MerchantCenterLinkServiceClient merchantCenterLinkServiceClient = MerchantCenterLinkServiceClient.Create();
     // Initialize request argument(s)
     MutateMerchantCenterLinkRequest request = new MutateMerchantCenterLinkRequest
     {
         CustomerId = "",
         Operation  = new MerchantCenterLinkOperation(),
     };
     // Make the request
     MutateMerchantCenterLinkResponse response = merchantCenterLinkServiceClient.MutateMerchantCenterLink(request);
 }
Exemplo n.º 4
0
 /// <summary>Snippet for MutateMerchantCenterLink</summary>
 public void MutateMerchantCenterLinkRequestObject()
 {
     // Snippet: MutateMerchantCenterLink(MutateMerchantCenterLinkRequest, CallSettings)
     // Create client
     MerchantCenterLinkServiceClient merchantCenterLinkServiceClient = MerchantCenterLinkServiceClient.Create();
     // Initialize request argument(s)
     MutateMerchantCenterLinkRequest request = new MutateMerchantCenterLinkRequest
     {
         CustomerId   = "",
         Operation    = new MerchantCenterLinkOperation(),
         ValidateOnly = false,
     };
     // Make the request
     MutateMerchantCenterLinkResponse response = merchantCenterLinkServiceClient.MutateMerchantCenterLink(request);
     // 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}");
        }