Esempio n. 1
0
        public void SubmitReview_ShouldReturnResult()
        {
            var submissionId = _testData.GetSubmissionId();
            var submissionResult = new SubmissionResult {
                SubmissionID = submissionId
            }.Invoke();
            var changes = (JObject)submissionResult["results"]["document"]["results"];

            var result = new SubmitReview {
                SubmissionID = submissionId, Changes = new InArgument <JObject>(_ => changes),
            }.Invoke();

            result.Should().NotBeNull();
            result.Value <int>("review_id").Should().BeGreaterThan(0);
            result.Value <int>("submission_id").Should().BeGreaterThan(0);
        }
 public static JObject Invoke(this SubmitReview submitReviewActivity) =>
 submitReviewActivity.Invoke <SubmitReview, JObject>((a, outArg) => a.Result = outArg);
        /// <summary>
        /// Use submit_review when a user-submitted review of a product or seller.
        /// </summary>
        /// <exception cref="ai.thirdwatch.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="JSON">Pass review to thirdwatch. Only &#x60;_userID&#x60; is required field. But this should contain review info.</param>
        /// <returns>Task of ApiResponse (EventResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <EventResponse> > SubmitReviewAsyncWithHttpInfo(SubmitReview JSON)
        {
            // verify the required parameter 'JSON' is set
            if (JSON == null)
            {
                throw new ApiException(400, "Missing required parameter 'JSON' when calling SubmitReviewApi->SubmitReview");
            }

            var    localVarPath         = "/v1/submit_review";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(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 = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (JSON != null && JSON.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(JSON); // http body (model) parameter
            }
            else
            {
                localVarPostBody = JSON; // byte array
            }

            // authentication (api_key) required
            if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("X-THIRDWATCH-API-KEY")))
            {
                localVarHeaderParams["X-THIRDWATCH-API-KEY"] = Configuration.GetApiKeyWithPrefix("X-THIRDWATCH-API-KEY");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("SubmitReview", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <EventResponse>(localVarStatusCode,
                                                   localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                   (EventResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(EventResponse))));
        }
        /// <summary>
        /// Use submit_review when a user-submitted review of a product or seller.
        /// </summary>
        /// <exception cref="ai.thirdwatch.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="JSON">Pass review to thirdwatch. Only &#x60;_userID&#x60; is required field. But this should contain review info.</param>
        /// <returns>Task of EventResponse</returns>
        public async System.Threading.Tasks.Task <EventResponse> SubmitReviewAsync(SubmitReview JSON)
        {
            ApiResponse <EventResponse> localVarResponse = await SubmitReviewAsyncWithHttpInfo(JSON);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Use submit_review when a user-submitted review of a product or seller.
        /// </summary>
        /// <exception cref="ai.thirdwatch.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="JSON">Pass review to thirdwatch. Only &#x60;_userID&#x60; is required field. But this should contain review info.</param>
        /// <returns>EventResponse</returns>
        public EventResponse SubmitReview(SubmitReview JSON)
        {
            ApiResponse <EventResponse> localVarResponse = SubmitReviewWithHttpInfo(JSON);

            return(localVarResponse.Data);
        }