public override RequestStatus RequestContentUpdate(Guid previewToolId, ContentUpdateRequestFromPreviewTool contentUpdateRequest) { string[] parameters; if (tryGetRequestParameters(items => new Communication.Model.ContentUpdateRequestFromPreviewTool() { PreviewPartIds = items, TargetLangCodes = contentUpdateRequest.TargetLangCodes }, contentUpdateRequest.PreviewPartIds, out parameters)) { var correlationId = Guid.NewGuid(); for (int i = 0; i < parameters.Length; i++) { var requestStatus = sendRequest("content", HttpMethod.Post, previewToolId, parameters[i]); if (!requestStatus.RequestAccepted) { return(requestStatus); } } return(RequestStatus.Success()); } else { return(RequestStatus.Failed(ErrorCodes.UnexpectedError, "Unable to get the REST request parameters.")); } }
private RequestStatus sendRequest(string relativeUrl, HttpMethod httpMethod, Guid?previewToolId, string parameters) { Communication.Model.ConnectionResponse response; ErrorCodes?errorCode; string errorMessage; var result = sendRequest(relativeUrl, httpMethod, previewToolId, parameters, out response, out errorCode, out errorMessage); if (result == HttpStatusCode.OK) { if (response != null) { callbackService = new CallbackService(response.CallbackAddress, CallbackHandler, response.PingIntervalInSecs, onConnectionClosed); callbackService.Start(); } return(RequestStatus.Success()); } else { return(RequestStatus.Failed(errorCode.Value, errorMessage)); } }