Example #1
0
        /// <summary>
        /// Accepts the invitation.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="clientCustomerId">The client customer ID.</param>
        /// <param name="managerLinkResourceName">The manager link resource name.</param>
        private void AcceptInvitation(GoogleAdsClient client, long clientCustomerId,
                                      string managerLinkResourceName)
        {
            // Get the CustomerManagerLinkService.
            CustomerManagerLinkServiceClient customerManagerLinkService =
                client.GetService(Services.V1.CustomerManagerLinkService);

            // Create a client with the manager customer ID as login customer ID.
            client.Config.LoginCustomerId = clientCustomerId.ToString();

            // Creates the customer manager link with the updated status.
            CustomerManagerLink customerManagerLink = new CustomerManagerLink()
            {
                ResourceName = managerLinkResourceName,
                Status       = ManagerLinkStatus.Active
            };

            // Creates a customer manager link operation for updating the one above.
            CustomerManagerLinkOperation customerManagerLinkOperation =
                new CustomerManagerLinkOperation()
            {
                Update     = customerManagerLink,
                UpdateMask = FieldMasks.AllSetFieldsOf(customerManagerLink)
            };

            // Issue a mutate request to update the customer manager link.
            MutateCustomerManagerLinkResponse response =
                customerManagerLinkService.MutateCustomerManagerLink(
                    clientCustomerId.ToString(), new[] { customerManagerLinkOperation }
                    );

            // Prints the result.
            Console.WriteLine($"The client {clientCustomerId} accepted the invitation with " +
                              $"the resource name '{response.Results[0].ResourceName}");
        }
Example #2
0
 /// <summary>Snippet for MutateCustomerManagerLink</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCustomerManagerLink()
 {
     // Create client
     CustomerManagerLinkServiceClient customerManagerLinkServiceClient = CustomerManagerLinkServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     IEnumerable <CustomerManagerLinkOperation> operations = new CustomerManagerLinkOperation[]
     {
         new CustomerManagerLinkOperation(),
     };
     // Make the request
     MutateCustomerManagerLinkResponse response = customerManagerLinkServiceClient.MutateCustomerManagerLink(customerId, operations);
 }
Example #3
0
        /// <summary>Snippet for MutateCustomerManagerLinkAsync</summary>
        public async Task MutateCustomerManagerLinkAsync()
        {
            // Snippet: MutateCustomerManagerLinkAsync(string, IEnumerable<CustomerManagerLinkOperation>, CallSettings)
            // Additional: MutateCustomerManagerLinkAsync(string, IEnumerable<CustomerManagerLinkOperation>, CancellationToken)
            // Create client
            CustomerManagerLinkServiceClient customerManagerLinkServiceClient = await CustomerManagerLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            IEnumerable <CustomerManagerLinkOperation> operations = new CustomerManagerLinkOperation[]
            {
                new CustomerManagerLinkOperation(),
            };
            // Make the request
            MutateCustomerManagerLinkResponse response = await customerManagerLinkServiceClient.MutateCustomerManagerLinkAsync(customerId, operations);

            // End snippet
        }