private void OnAddFeedback(FeedbackReturn response, Dictionary <string, object> customData) { Log.Debug("TestCompareComplyV1.OnAddFeedback()", "AddFeedback Response: {0}", customData["json"].ToString()); Test(response != null); Test(!string.IsNullOrEmpty(response.FeedbackId)); feedbackId = response.FeedbackId; addFeedbackTested = true; }
/// <summary> /// Add feedback. /// /// Adds feedback in the form of _labels_ from a subject-matter expert (SME) to a governing document. /// **Important:** Feedback is not immediately incorporated into the training model, nor is it guaranteed to be /// incorporated at a later date. Instead, submitted feedback is used to suggest future updates to the training /// model. /// </summary> /// <param name="feedbackData">An object that defines the feedback to be submitted.</param> /// <param name="customData">Custom data object to pass data including custom request headers.</param> /// <returns><see cref="FeedbackReturn" />FeedbackReturn</returns> public FeedbackReturn AddFeedback(FeedbackInput feedbackData, Dictionary <string, object> customData = null) { if (feedbackData == null) { throw new ArgumentNullException(nameof(feedbackData)); } if (string.IsNullOrEmpty(VersionDate)) { throw new ArgumentNullException("versionDate cannot be null."); } FeedbackReturn result = null; try { IClient client = this.Client; if (_tokenManager != null) { client = this.Client.WithAuthentication(_tokenManager.GetToken()); } var restRequest = client.PostAsync($"{this.Endpoint}/v1/feedback"); restRequest.WithArgument("version", VersionDate); restRequest.WithBody <FeedbackInput>(feedbackData); if (customData != null) { restRequest.WithCustomData(customData); } restRequest.WithHeader("X-IBMCloud-SDK-Analytics", "service_name=compare-comply;service_version=v1;operation_id=AddFeedback"); result = restRequest.As <FeedbackReturn>().Result; if (result == null) { result = new FeedbackReturn(); } result.CustomData = restRequest.CustomData; } catch (AggregateException ae) { throw ae.Flatten(); } return(result); }
public IEnumerator TestAddFeedback() { Log.Debug("CompareComplyServiceV1IntegrationTests", "Attempting to AddFeedback..."); FeedbackReturn addFeedbackResponse = null; #region feedbackData var feedbackData = new FeedbackDataInput() { FeedbackType = "element_classification", Document = new ShortDoc() { Hash = "", Title = "doc title" }, ModelId = "contracts", ModelVersion = "11.00", Location = new Location() { Begin = 241, End = 237 }, Text = "1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing infrastructure.", OriginalLabels = new OriginalLabelsIn() { Types = new List <TypeLabel>() { new TypeLabel() { Label = new Label() { Nature = "Obligation", Party = "IBM" }, ProvenanceIds = new List <string>() { "85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795" } }, new TypeLabel() { Label = new Label() { Nature = "End User", Party = "Exclusion" }, ProvenanceIds = new List <string>() { "85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795" } } }, Categories = new List <Category>() { new Category() { Label = Category.LabelValue.RESPONSIBILITIES, ProvenanceIds = new List <string>() { } }, new Category() { Label = Category.LabelValue.AMENDMENTS, ProvenanceIds = new List <string>() { } } } }, UpdatedLabels = new UpdatedLabelsIn() { Types = new List <TypeLabel>() { new TypeLabel() { Label = new Label() { Nature = "Obligation", Party = "IBM" } }, new TypeLabel() { Label = new Label() { Nature = "Disclaimer", Party = "buyer" } } }, Categories = new List <Category>() { new Category() { Label = Category.LabelValue.RESPONSIBILITIES, }, new Category() { Label = Category.LabelValue.AUDITS } } } }; #endregion service.AddFeedback( callback: (DetailedResponse <FeedbackReturn> response, IBMError error) => { Log.Debug("CompareComplyServiceV1IntegrationTests", "AddFeedback result: {0}", response.Response); addFeedbackResponse = response.Result; createdFeedbackId = addFeedbackResponse.FeedbackId; Assert.IsNotNull(addFeedbackResponse); Assert.IsNotNull(createdFeedbackId); Assert.IsNull(error); }, feedbackData: feedbackData, userId: "user_id_123x", comment: "Test feedback comment" ); while (addFeedbackResponse == null) { yield return(null); } }
private void OnAddFeedback(FeedbackReturn response, Dictionary <string, object> customData) { Log.Debug("ExampleCompareComplyV1.OnAddFeedback()", "AddFeedback Response: {0}", customData["json"].ToString()); feedbackId = response.FeedbackId; addFeedbackTested = true; }