internal virtual UpdateWebhookResponse UpdateWebhook(UpdateWebhookRequest request)
        {
            var marshaller   = UpdateWebhookRequestMarshaller.Instance;
            var unmarshaller = UpdateWebhookResponseUnmarshaller.Instance;

            return(Invoke <UpdateWebhookRequest, UpdateWebhookResponse>(request, marshaller, unmarshaller));
        }
        public async stt::Task UpdateWebhookAsync()
        {
            moq::Mock <Webhooks.WebhooksClient> mockGrpcClient = new moq::Mock <Webhooks.WebhooksClient>(moq::MockBehavior.Strict);
            UpdateWebhookRequest request = new UpdateWebhookRequest
            {
                Webhook    = new Webhook(),
                UpdateMask = new wkt::FieldMask(),
            };
            Webhook expectedResponse = new Webhook
            {
                WebhookName       = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"),
                DisplayName       = "display_name137f65c2",
                GenericWebService = new Webhook.Types.GenericWebService(),
                Disabled          = false,
                Timeout           = new wkt::Duration(),
            };

            mockGrpcClient.Setup(x => x.UpdateWebhookAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Webhook>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            WebhooksClient client = new WebhooksClientImpl(mockGrpcClient.Object, null);
            Webhook        responseCallSettings = await client.UpdateWebhookAsync(request.Webhook, request.UpdateMask, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Webhook responseCancellationToken = await client.UpdateWebhookAsync(request.Webhook, request.UpdateMask, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateWebhook()
        {
            moq::Mock <Webhooks.WebhooksClient> mockGrpcClient = new moq::Mock <Webhooks.WebhooksClient>(moq::MockBehavior.Strict);
            UpdateWebhookRequest request = new UpdateWebhookRequest
            {
                Webhook    = new Webhook(),
                UpdateMask = new wkt::FieldMask(),
            };
            Webhook expectedResponse = new Webhook
            {
                WebhookName       = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"),
                DisplayName       = "display_name137f65c2",
                GenericWebService = new Webhook.Types.GenericWebService(),
                Disabled          = false,
                Timeout           = new wkt::Duration(),
                ServiceDirectory  = new Webhook.Types.ServiceDirectoryConfig(),
            };

            mockGrpcClient.Setup(x => x.UpdateWebhook(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            WebhooksClient client   = new WebhooksClientImpl(mockGrpcClient.Object, null);
            Webhook        response = client.UpdateWebhook(request.Webhook, request.UpdateMask);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>
        /// Initiates the asynchronous execution of the UpdateWebhook operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UpdateWebhook operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/UpdateWebhook">REST API Reference for UpdateWebhook Operation</seealso>
        public virtual Task <UpdateWebhookResponse> UpdateWebhookAsync(UpdateWebhookRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = UpdateWebhookRequestMarshaller.Instance;
            var unmarshaller = UpdateWebhookResponseUnmarshaller.Instance;

            return(InvokeAsync <UpdateWebhookRequest, UpdateWebhookResponse>(request, marshaller,
                                                                             unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the UpdateWebhook operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UpdateWebhook operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/UpdateWebhook">REST API Reference for UpdateWebhook Operation</seealso>
        public virtual Task <UpdateWebhookResponse> UpdateWebhookAsync(UpdateWebhookRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = UpdateWebhookRequestMarshaller.Instance;
            options.ResponseUnmarshaller = UpdateWebhookResponseUnmarshaller.Instance;

            return(InvokeAsync <UpdateWebhookResponse>(request, options, cancellationToken));
        }
        internal virtual UpdateWebhookResponse UpdateWebhook(UpdateWebhookRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = UpdateWebhookRequestMarshaller.Instance;
            options.ResponseUnmarshaller = UpdateWebhookResponseUnmarshaller.Instance;

            return(Invoke <UpdateWebhookResponse>(request, options));
        }
Exemple #7
0
        public async Task <Webhook> UpdateWebhookAsync(long id, UpdateWebhookRequest updateWebhookRequest)
        {
            ValidateModel(updateWebhookRequest);

            var response = await PutAsJsonAsync($"/webhooks/{id}", JsonConvert.SerializeObject(updateWebhookRequest));

            return(JsonConvert.DeserializeObject <WebhookResponse>(
                       await response.Content.ReadAsStringAsync()).Webhook);
        }
 /// <summary>Snippet for UpdateWebhook</summary>
 public void UpdateWebhookRequestObject()
 {
     // Snippet: UpdateWebhook(UpdateWebhookRequest, CallSettings)
     // Create client
     WebhooksClient webhooksClient = WebhooksClient.Create();
     // Initialize request argument(s)
     UpdateWebhookRequest request = new UpdateWebhookRequest
     {
         Webhook    = new Webhook(),
         UpdateMask = new FieldMask(),
     };
     // Make the request
     Webhook response = webhooksClient.UpdateWebhook(request);
     // End snippet
 }
        /// <summary>Snippet for UpdateWebhookAsync</summary>
        public async Task UpdateWebhookRequestObjectAsync()
        {
            // Snippet: UpdateWebhookAsync(UpdateWebhookRequest, CallSettings)
            // Additional: UpdateWebhookAsync(UpdateWebhookRequest, CancellationToken)
            // Create client
            WebhooksClient webhooksClient = await WebhooksClient.CreateAsync();

            // Initialize request argument(s)
            UpdateWebhookRequest request = new UpdateWebhookRequest
            {
                Webhook    = new Webhook(),
                UpdateMask = new FieldMask(),
            };
            // Make the request
            Webhook response = await webhooksClient.UpdateWebhookAsync(request);

            // End snippet
        }