Exemplo n.º 1
0
 private void OnDeleteFeedback(FeedbackDeleted response, Dictionary <string, object> customData)
 {
     Log.Debug("TestCompareComplyV1.OnGetFeedback()", "GetFeedback Response: {0}", customData["json"].ToString());
     Test(response != null);
     Test(!string.IsNullOrEmpty(response.Message));
     deleteFeedbackTested = true;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Deletes a specified feedback entry.
        /// </summary>
        /// <param name="feedbackId">A string that specifies the feedback entry to be deleted from the document.</param>
        /// <param name="modelId">The analysis model to be used by the service. For the `/v1/element_classification` and
        /// `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`.
        /// These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests.
        /// (optional)</param>
        /// <param name="customData">Custom data object to pass data including custom request headers.</param>
        /// <returns><see cref="FeedbackDeleted" />FeedbackDeleted</returns>
        public FeedbackDeleted DeleteFeedback(string feedbackId, string modelId = null, Dictionary <string, object> customData = null)
        {
            if (string.IsNullOrEmpty(feedbackId))
            {
                throw new ArgumentNullException(nameof(feedbackId));
            }

            if (string.IsNullOrEmpty(VersionDate))
            {
                throw new ArgumentNullException("versionDate cannot be null.");
            }

            FeedbackDeleted result = null;

            try
            {
                IClient client = this.Client;
                if (_tokenManager != null)
                {
                    client = this.Client.WithAuthentication(_tokenManager.GetToken());
                }

                var restRequest = client.DeleteAsync($"{this.Endpoint}/v1/feedback/{feedbackId}");

                restRequest.WithArgument("version", VersionDate);
                if (!string.IsNullOrEmpty(modelId))
                {
                    restRequest.WithArgument("model_id", modelId);
                }
                if (customData != null)
                {
                    restRequest.WithCustomData(customData);
                }

                restRequest.WithHeader("X-IBMCloud-SDK-Analytics", "service_name=compare-comply;service_version=v1;operation_id=DeleteFeedback");
                result = restRequest.As <FeedbackDeleted>().Result;
                if (result == null)
                {
                    result = new FeedbackDeleted();
                }
                result.CustomData = restRequest.CustomData;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
 private void OnDeleteFeedback(FeedbackDeleted response, Dictionary <string, object> customData)
 {
     Log.Debug("ExampleCompareComplyV1.OnGetFeedback()", "GetFeedback Response: {0}", customData["json"].ToString());
     deleteFeedbackTested = true;
 }