Esempio n. 1
0
        public async stt::Task AddBatchJobOperations2ResourceNamesAsync()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            AddBatchJobOperationsRequest request = new AddBatchJobOperationsRequest
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
                MutateOperations           =
                {
                    new MutateOperation(),
                },
            };
            AddBatchJobOperationsResponse expectedResponse = new AddBatchJobOperationsResponse
            {
                TotalOperations   = -8188520186954789005L,
                NextSequenceToken = "next_sequence_token160dabc7",
            };

            mockGrpcClient.Setup(x => x.AddBatchJobOperationsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AddBatchJobOperationsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            BatchJobServiceClient         client = new BatchJobServiceClientImpl(mockGrpcClient.Object, null);
            AddBatchJobOperationsResponse responseCallSettings = await client.AddBatchJobOperationsAsync(request.ResourceNameAsBatchJobName, request.MutateOperations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            AddBatchJobOperationsResponse responseCancellationToken = await client.AddBatchJobOperationsAsync(request.ResourceNameAsBatchJobName, request.MutateOperations, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 2
0
        public void AddBatchJobOperations2ResourceNames()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            AddBatchJobOperationsRequest request = new AddBatchJobOperationsRequest
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
                MutateOperations           =
                {
                    new MutateOperation(),
                },
            };
            AddBatchJobOperationsResponse expectedResponse = new AddBatchJobOperationsResponse
            {
                TotalOperations   = -8188520186954789005L,
                NextSequenceToken = "next_sequence_token160dabc7",
            };

            mockGrpcClient.Setup(x => x.AddBatchJobOperations(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            BatchJobServiceClient         client   = new BatchJobServiceClientImpl(mockGrpcClient.Object, null);
            AddBatchJobOperationsResponse response = client.AddBatchJobOperations(request.ResourceNameAsBatchJobName, request.MutateOperations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for AddBatchJobOperations</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void AddBatchJobOperations2ResourceNames()
 {
     // Create client
     BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.Create();
     // Initialize request argument(s)
     BatchJobName resourceName = BatchJobName.FromCustomerBatchJob("[CUSTOMER_ID]", "[BATCH_JOB_ID]");
     IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
     {
         new MutateOperation(),
     };
     // Make the request
     AddBatchJobOperationsResponse response = batchJobServiceClient.AddBatchJobOperations(resourceName, mutateOperations);
 }
 /// <summary>Snippet for AddBatchJobOperations</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void AddBatchJobOperations2()
 {
     // Create client
     BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/batchJobs/[BATCH_JOB]";
     IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
     {
         new MutateOperation(),
     };
     // Make the request
     AddBatchJobOperationsResponse response = batchJobServiceClient.AddBatchJobOperations(resourceName, mutateOperations);
 }
Esempio n. 5
0
        /// <summary>Snippet for AddBatchJobOperationsAsync</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 AddBatchJobOperations2ResourceNamesAsync()
        {
            // Create client
            BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchJobName resourceName = BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]");
            IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
            {
                new MutateOperation(),
            };
            // Make the request
            AddBatchJobOperationsResponse response = await batchJobServiceClient.AddBatchJobOperationsAsync(resourceName, mutateOperations);
        }
Esempio n. 6
0
        /// <summary>Snippet for AddBatchJobOperationsAsync</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 AddBatchJobOperations2Async()
        {
            // Create client
            BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/batchJobs/[BATCH_JOB_ID]";
            IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
            {
                new MutateOperation(),
            };
            // Make the request
            AddBatchJobOperationsResponse response = await batchJobServiceClient.AddBatchJobOperationsAsync(resourceName, mutateOperations);
        }
 /// <summary>Snippet for AddBatchJobOperations</summary>
 public void AddBatchJobOperations1ResourceNames()
 {
     // Snippet: AddBatchJobOperations(BatchJobName, string, IEnumerable<MutateOperation>, CallSettings)
     // Create client
     BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.Create();
     // Initialize request argument(s)
     BatchJobName resourceName  = BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]");
     string       sequenceToken = "";
     IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
     {
         new MutateOperation(),
     };
     // Make the request
     AddBatchJobOperationsResponse response = batchJobServiceClient.AddBatchJobOperations(resourceName, sequenceToken, mutateOperations);
     // End snippet
 }
Esempio n. 8
0
 /// <summary>Snippet for AddBatchJobOperations</summary>
 public void AddBatchJobOperations1()
 {
     // Snippet: AddBatchJobOperations(string, string, IEnumerable<MutateOperation>, CallSettings)
     // Create client
     BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.Create();
     // Initialize request argument(s)
     string resourceName  = "customers/[CUSTOMER_ID]/batchJobs/[BATCH_JOB_ID]";
     string sequenceToken = "";
     IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
     {
         new MutateOperation(),
     };
     // Make the request
     AddBatchJobOperationsResponse response = batchJobServiceClient.AddBatchJobOperations(resourceName, sequenceToken, mutateOperations);
     // End snippet
 }
Esempio n. 9
0
 /// <summary>Snippet for AddBatchJobOperations</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void AddBatchJobOperationsRequestObject()
 {
     // Create client
     BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.Create();
     // Initialize request argument(s)
     AddBatchJobOperationsRequest request = new AddBatchJobOperationsRequest
     {
         ResourceNameAsBatchJobName = BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
         SequenceToken    = "",
         MutateOperations =
         {
             new MutateOperation(),
         },
     };
     // Make the request
     AddBatchJobOperationsResponse response = batchJobServiceClient.AddBatchJobOperations(request);
 }
        /// <summary>
        /// Adds all batch job operations to the batch job. As this is the first time for this
        /// batch job, the sequence token is not set. The response will contain the next sequence
        /// token that you can use to upload more operations in the future.
        /// </summary>
        /// <param name="batchJobService">The batch job service.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        /// <param name="batchJobResourceName">The resource name of batch job to which the batch
        /// job operations will be added.
        /// </param>
        private static void AddAllBatchJobOperations(BatchJobServiceClient batchJobService,
                                                     long customerId, string batchJobResourceName)
        {
            AddBatchJobOperationsResponse response =
                batchJobService.AddBatchJobOperations(
                    new AddBatchJobOperationsRequest()
            {
                ResourceName     = batchJobResourceName,
                MutateOperations = { BuildAllOperations(customerId) }
            });

            Console.WriteLine($"{response.TotalOperations} mutate operations have been added" +
                              $" so far.");

            // You can use this next sequence token for calling AddBatchJobOperations() next time.
            Console.WriteLine($"Next sequence token for adding next operations is " +
                              $"'{response.NextSequenceToken}'.");
        }
        /// <summary>Snippet for AddBatchJobOperationsAsync</summary>
        public async Task AddBatchJobOperations2Async()
        {
            // Snippet: AddBatchJobOperationsAsync(string, IEnumerable<MutateOperation>, CallSettings)
            // Additional: AddBatchJobOperationsAsync(string, IEnumerable<MutateOperation>, CancellationToken)
            // Create client
            BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/batchJobs/[BATCH_JOB]";
            IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
            {
                new MutateOperation(),
            };
            // Make the request
            AddBatchJobOperationsResponse response = await batchJobServiceClient.AddBatchJobOperationsAsync(resourceName, mutateOperations);

            // End snippet
        }
Esempio n. 12
0
        /// <summary>Snippet for AddBatchJobOperationsAsync</summary>
        public async Task AddBatchJobOperations2ResourceNamesAsync()
        {
            // Snippet: AddBatchJobOperationsAsync(BatchJobName, IEnumerable<MutateOperation>, CallSettings)
            // Additional: AddBatchJobOperationsAsync(BatchJobName, IEnumerable<MutateOperation>, CancellationToken)
            // Create client
            BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchJobName resourceName = BatchJobName.FromCustomerBatchJob("[CUSTOMER_ID]", "[BATCH_JOB_ID]");
            IEnumerable <MutateOperation> mutateOperations = new MutateOperation[]
            {
                new MutateOperation(),
            };
            // Make the request
            AddBatchJobOperationsResponse response = await batchJobServiceClient.AddBatchJobOperationsAsync(resourceName, mutateOperations);

            // End snippet
        }
        /// <summary>Snippet for AddBatchJobOperationsAsync</summary>
        public async Task AddBatchJobOperationsRequestObjectAsync()
        {
            // Snippet: AddBatchJobOperationsAsync(AddBatchJobOperationsRequest, CallSettings)
            // Additional: AddBatchJobOperationsAsync(AddBatchJobOperationsRequest, CancellationToken)
            // Create client
            BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync();

            // Initialize request argument(s)
            AddBatchJobOperationsRequest request = new AddBatchJobOperationsRequest
            {
                ResourceNameAsBatchJobName = BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
                SequenceToken    = "",
                MutateOperations =
                {
                    new MutateOperation(),
                },
            };
            // Make the request
            AddBatchJobOperationsResponse response = await batchJobServiceClient.AddBatchJobOperationsAsync(request);

            // End snippet
        }