예제 #1
0
        /// <summary>
        /// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="orderId">ID of pet that needs to be fetched</param>
        /// <returns>Task of ApiResponse (Order)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Order> > GetOrderByIdAsyncWithHttpInfo(long?orderId)
        {
            // verify the required parameter 'orderId' is set
            if (orderId == null)
            {
                throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
            }

            var localVarPath = "./store/order/{order_id}";

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/xml",
                "application/json"
            };
            var requestParameters = new RequestParameters(Configuration, contentTypes: localVarHttpContentTypes, accepts: localVarHttpHeaderAccepts);

            requestParameters.AddPath("order_id", orderId); // path parameter


            // make the HTTP request
            var localVarResponse = await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                   new HttpMethod("GET"), requestParameters);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <Order>(localVarStatusCode,
                                           localVarResponse.ToHeaders(),
                                           this.Configuration.ApiClient.Deserialize <Order>(localVarResponse)));
        }
예제 #2
0
        /// <summary>
        /// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="orderId">ID of the order that needs to be deleted</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public ApiResponse <Object> DeleteOrderWithHttpInfo(string orderId)
        {
            // verify the required parameter 'orderId' is set
            if (orderId == null)
            {
                throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
            }

            var localVarPath = "./store/order/{order_id}";

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/xml",
                "application/json"
            };
            var requestParameters = new RequestParameters(Configuration, contentTypes: localVarHttpContentTypes, accepts: localVarHttpHeaderAccepts);

            requestParameters.AddPath("order_id", orderId); // path parameter


            // make the HTTP request
            var localVarResponse = this.Configuration.ApiClient.CallApi(localVarPath,
                                                                        new HttpMethod("DELETE"), requestParameters);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <Object>(localVarStatusCode,
                                            localVarResponse.ToHeaders(),
                                            null));
        }