/// <summary>Snippet for MutateCustomerClientLink</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateCustomerClientLink()
 {
     // Create client
     CustomerClientLinkServiceClient customerClientLinkServiceClient = CustomerClientLinkServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     CustomerClientLinkOperation operation = new CustomerClientLinkOperation();
     // Make the request
     MutateCustomerClientLinkResponse response = customerClientLinkServiceClient.MutateCustomerClientLink(customerId, operation);
 }
        /// <summary>Snippet for MutateCustomerClientLinkAsync</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 MutateCustomerClientLinkAsync()
        {
            // Create client
            CustomerClientLinkServiceClient customerClientLinkServiceClient = await CustomerClientLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            CustomerClientLinkOperation operation = new CustomerClientLinkOperation();
            // Make the request
            MutateCustomerClientLinkResponse response = await customerClientLinkServiceClient.MutateCustomerClientLinkAsync(customerId, operation);
        }
        /// <summary>Snippet for MutateCustomerClientLinkAsync</summary>
        public async Task MutateCustomerClientLinkAsync()
        {
            // Snippet: MutateCustomerClientLinkAsync(string, CustomerClientLinkOperation, CallSettings)
            // Additional: MutateCustomerClientLinkAsync(string, CustomerClientLinkOperation, CancellationToken)
            // Create client
            CustomerClientLinkServiceClient customerClientLinkServiceClient = await CustomerClientLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            CustomerClientLinkOperation operation = new CustomerClientLinkOperation();
            // Make the request
            MutateCustomerClientLinkResponse response = await customerClientLinkServiceClient.MutateCustomerClientLinkAsync(customerId, operation);

            // End snippet
        }
        public async Task MutateCustomerClientLinkAsync()
        {
            Mock <CustomerClientLinkService.CustomerClientLinkServiceClient> mockGrpcClient = new Mock <CustomerClientLinkService.CustomerClientLinkServiceClient>(MockBehavior.Strict);
            MutateCustomerClientLinkRequest expectedRequest = new MutateCustomerClientLinkRequest
            {
                CustomerId = "customerId-1772061412",
                Operation  = new CustomerClientLinkOperation(),
            };
            MutateCustomerClientLinkResponse expectedResponse = new MutateCustomerClientLinkResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerClientLinkAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCustomerClientLinkResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerClientLinkServiceClient client = new CustomerClientLinkServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            CustomerClientLinkOperation      operation = new CustomerClientLinkOperation();
            MutateCustomerClientLinkResponse response  = await client.MutateCustomerClientLinkAsync(customerId, operation);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCustomerClientLink()
        {
            Mock <CustomerClientLinkService.CustomerClientLinkServiceClient> mockGrpcClient = new Mock <CustomerClientLinkService.CustomerClientLinkServiceClient>(MockBehavior.Strict);
            MutateCustomerClientLinkRequest expectedRequest = new MutateCustomerClientLinkRequest
            {
                CustomerId = "customerId-1772061412",
                Operation  = new CustomerClientLinkOperation(),
            };
            MutateCustomerClientLinkResponse expectedResponse = new MutateCustomerClientLinkResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerClientLink(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerClientLinkServiceClient client = new CustomerClientLinkServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            CustomerClientLinkOperation      operation = new CustomerClientLinkOperation();
            MutateCustomerClientLinkResponse response  = client.MutateCustomerClientLink(customerId, operation);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #6
0
        /// <summary>
        /// Extends an invitation from a manager customer to a client customer.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="managerCustomerId">The manager customer ID.</param>
        /// <param name="clientCustomerId">The client customer ID.</param>
        /// <returns>The invitation resource name.</returns>
        private string CreateInvitation(GoogleAdsClient client, long managerCustomerId,
                                        long clientCustomerId)
        {
            // Get the CustomerClientLinkService.
            CustomerClientLinkServiceClient customerClientLinkService =
                client.GetService(Services.V1.CustomerClientLinkService);

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

            // Create a customer client link.
            CustomerClientLink customerClientLink = new CustomerClientLink()
            {
                ClientCustomer = ResourceNames.Customer(clientCustomerId),

                // Sets the client customer to invite.
                Status = ManagerLinkStatus.Pending
            };

            // Creates a customer client link operation for creating the one above.
            CustomerClientLinkOperation customerClientLinkOperation =
                new CustomerClientLinkOperation()
            {
                Create = customerClientLink
            };

            // Issue a mutate request to create the customer client link.
            MutateCustomerClientLinkResponse response =
                customerClientLinkService.MutateCustomerClientLink(
                    managerCustomerId.ToString(), customerClientLinkOperation);

            // Prints the result.
            string customerClientLinkResourceName = response.Result.ResourceName;

            Console.WriteLine($"An invitation has been extended from the manager " +
                              $"customer {managerCustomerId} to the client customer {clientCustomerId} with " +
                              $"the customer client link resource name '{customerClientLinkResourceName}'.");

            // Returns the resource name of the created customer client link.
            return(customerClientLinkResourceName);
        }
Example #7
0
 /// <summary>
 /// Creates or updates a customer client link. Operation statuses are returned.
 ///
 /// List of thrown errors:
 /// [AuthenticationError]()
 /// [AuthorizationError]()
 /// [DatabaseError]()
 /// [FieldError]()
 /// [FieldMaskError]()
 /// [HeaderError]()
 /// [InternalError]()
 /// [ManagerLinkError]()
 /// [MutateError]()
 /// [NewResourceCreationError]()
 /// [QuotaError]()
 /// [RequestError]()
 /// </summary>
 /// <param name="customerId">
 /// Required. The ID of the customer whose customer link are being modified.
 /// </param>
 /// <param name="operation">
 /// Required. The operation to perform on the individual CustomerClientLink.
 /// </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 <MutateCustomerClientLinkResponse> MutateCustomerClientLinkAsync(string customerId, CustomerClientLinkOperation operation, st::CancellationToken cancellationToken) =>
 MutateCustomerClientLinkAsync(customerId, operation, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
Example #8
0
 /// <summary>
 /// Creates or updates a customer client link. Operation statuses are returned.
 ///
 /// List of thrown errors:
 /// [AuthenticationError]()
 /// [AuthorizationError]()
 /// [DatabaseError]()
 /// [FieldError]()
 /// [FieldMaskError]()
 /// [HeaderError]()
 /// [InternalError]()
 /// [ManagerLinkError]()
 /// [MutateError]()
 /// [NewResourceCreationError]()
 /// [QuotaError]()
 /// [RequestError]()
 /// </summary>
 /// <param name="customerId">
 /// Required. The ID of the customer whose customer link are being modified.
 /// </param>
 /// <param name="operation">
 /// Required. The operation to perform on the individual CustomerClientLink.
 /// </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 <MutateCustomerClientLinkResponse> MutateCustomerClientLinkAsync(string customerId, CustomerClientLinkOperation operation, gaxgrpc::CallSettings callSettings = null) =>
 MutateCustomerClientLinkAsync(new MutateCustomerClientLinkRequest
 {
     CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)),
     Operation  = gax::GaxPreconditions.CheckNotNull(operation, nameof(operation)),
 }, callSettings);