public void DeleteFeedback() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); var result = service.DeleteFeedback( feedbackId: "{feedback-id}" ); Console.WriteLine(result.Response); }
public void DeleteFeedback() { IamConfig config = new IamConfig( apikey: apikey ); CompareComplyService service = new CompareComplyService(versionDate, config); service.SetEndpoint(url); var result = service.DeleteFeedback( feedbackId: feedbackId ); Console.WriteLine(result.Response); }
public void DeleteFeedback() { TokenOptions tokenOptions = new TokenOptions() { IamApiKey = apikey, ServiceUrl = url }; CompareComplyService service = new CompareComplyService(tokenOptions, versionDate); var result = service.DeleteFeedback( feedbackId: feedbackId ); Console.WriteLine(result.Response); }
public void DeleteFeedback_Success() { IClient client = Substitute.For <IClient>(); IRequest request = Substitute.For <IRequest>(); client.DeleteAsync(Arg.Any <string>()) .Returns(request); CompareComplyService service = new CompareComplyService(client); var versionDate = "versionDate"; service.VersionDate = versionDate; var feedbackId = "feedbackId"; var model = "model"; var result = service.DeleteFeedback(feedbackId: feedbackId, model: model); request.Received().WithArgument("version", versionDate); client.Received().DeleteAsync($"{service.ServiceUrl}/v1/feedback/{feedbackId}"); }
public IEnumerator TestDeleteFeedback() { Log.Debug("CompareComplyServiceV1IntegrationTests", "Attempting to DeleteFeedback..."); FeedbackDeleted deleteFeedbackResponse = null; service.DeleteFeedback( callback: (DetailedResponse <FeedbackDeleted> response, IBMError error) => { Log.Debug("CompareComplyServiceV1IntegrationTests", "DeleteFeedback result: {0}", response.Response); deleteFeedbackResponse = response.Result; Assert.IsNotNull(deleteFeedbackResponse); Assert.IsTrue(deleteFeedbackResponse.Status == 200); Assert.IsTrue(deleteFeedbackResponse.Message.Contains(createdFeedbackId)); Assert.IsNull(error); }, feedbackId: createdFeedbackId, model: "contracts" ); while (deleteFeedbackResponse == null) { yield return(null); } }
public void Feedback_Success() { DateTime before = DateTime.Now; DateTime after = new DateTime(2018, 11, 13); service.WithHeader("X-Watson-Test", "1"); var ListFeedbackResult = service.ListFeedback( feedbackType: "element_classification", before: before, after: after, documentTitle: "doc title", modelId: "contracts", modelVersion: "11.00", categoryRemoved: "categoryRemoved", categoryAdded: "categoryAdded", categoryNotChanged: "categoryUnchanged", typeRemoved: "nature:party", typeAdded: "nature:party", typeNotChanged: "nature:party", pageLimit: 3, sort: "created" ); string userId = "user_id_123x"; string comment = "Test feedback comment"; #region feedbackData FeedbackDataInput 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.LabelEnumValue.RESPONSIBILITIES, ProvenanceIds = new List <string>() { } }, new Category() { Label = Category.LabelEnumValue.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.LabelEnumValue.RESPONSIBILITIES, }, new Category() { Label = Category.LabelEnumValue.AUDITS } } } }; #endregion service.WithHeader("X-Watson-Test", "1"); var addFeedbackResult = service.AddFeedback( feedbackData: feedbackData, userId: userId, comment: comment ); string feedbackId = addFeedbackResult.Result.FeedbackId; service.WithHeader("X-Watson-Test", "1"); var getFeedbackResult = service.GetFeedback( feedbackId: feedbackId, model: compareComplyModel ); service.WithHeader("X-Watson-Test", "1"); var deleteFeedbackResult = service.DeleteFeedback( feedbackId: feedbackId ); Assert.IsNotNull(deleteFeedbackResult.Result.Status); Assert.IsNotNull(getFeedbackResult.Result.FeedbackId); Assert.IsNotNull(addFeedbackResult.Result.FeedbackId); Assert.IsNotNull(ListFeedbackResult.Result.Feedback); }
public void Feedback_Success() { DateTime before = DateTime.Now; DateTime after = new DateTime(2018, 11, 13); var ListFeedbackResult = service.ListFeedback( feedbackType: "element_classification", before: before, after: after, documentTitle: "doc title", modelId: "contracts", modelVersion: "11.00", categoryRemoved: "categoryRemoved", categoryAdded: "categoryAdded", categoryNotChanged: "categoryUnchanged", typeRemoved: "nature:party", typeAdded: "nature:party", typeNotChanged: "nature:party", pageLimit: 3, sort: "sort" ); FeedbackInput feedbackData = new FeedbackInput() { UserId = "user_id_123x", Comment = "Test feedback comment", 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.LabelEnum.RESPONSIBILITIES, ProvenanceIds = new List <string>() { } }, new Category() { Label = Category.LabelEnum.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.LabelEnum.RESPONSIBILITIES, }, new Category() { Label = Category.LabelEnum.AUDITS } } } } }; var addFeedbackResult = service.AddFeedback(feedbackData); string feedbackId = addFeedbackResult.FeedbackId; // temporary fix for a bug requiring `x-watson-metadata` header Dictionary <string, object> customData = new Dictionary <string, object>(); Dictionary <string, string> customHeaders = new Dictionary <string, string>(); customHeaders.Add("x-watson-metadata", "customer_id=sdk-test-customer-id"); customData.Add(Constants.CUSTOM_REQUEST_HEADERS, customHeaders); var getFeedbackResult = service.GetFeedback(feedbackId, customData: customData); var deleteFeedbackResult = service.DeleteFeedback(feedbackId); Assert.IsNotNull(deleteFeedbackResult); Assert.IsNotNull(getFeedbackResult); Assert.IsNotNull(addFeedbackResult); Assert.IsNotNull(ListFeedbackResult); }