/// <summary> /// Alta de Webhook Registra un webhook en la plataforma para su uso como notificador de eventos, cuándo estos ocurran. /// </summary> /// <exception cref="MX.Wire4.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Información para registrar un Webhook</param> /// <param name="authorization">Header para token</param> /// <returns>Task of ApiResponse (WebhookResponse)</returns> public async System.Threading.Tasks.Task <ApiResponse <WebhookResponse> > RegisterWebhookAsyncWithHttpInfo(WebhookRequest body, string authorization) { // verify the required parameter 'body' is set if (body == null) { throw new ApiException(400, "Missing required parameter 'body' when calling WebhooksApi->RegisterWebhook"); } // verify the required parameter 'authorization' is set if (authorization == null) { throw new ApiException(400, "Missing required parameter 'authorization' when calling WebhooksApi->RegisterWebhook"); } var localVarPath = "/webhooks"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (authorization != null) { localVarHeaderParams.Add("Authorization", this.Configuration.ApiClient.ParameterToString(authorization)); // header parameter } if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("RegisterWebhook", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <WebhookResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (WebhookResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WebhookResponse)))); }