Пример #1
0
        /// <summary>
        ///  
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">ID of the duty</param>
        /// <param name="dutyCostDetails">Costing Information</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task<ApiResponse<Object>> SendDutyCostingAsyncWithHttpInfo (string id, DutyCostDetails dutyCostDetails)
        {
            // verify the required parameter 'id' is set
            if (id == null)
                throw new ApiException(400, "Missing required parameter 'id' when calling CostingApi->SendDutyCosting");
            // verify the required parameter 'dutyCostDetails' is set
            if (dutyCostDetails == null)
                throw new ApiException(400, "Missing required parameter 'dutyCostDetails' when calling CostingApi->SendDutyCosting");

            var localVarPath = "/duties/{id}/costing";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.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 = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (id != null) localVarPathParams.Add("id", this.Configuration.ApiClient.ParameterToString(id)); // path parameter
            if (dutyCostDetails != null && dutyCostDetails.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(dutyCostDetails); // http body (model) parameter
            }
            else
            {
                localVarPostBody = dutyCostDetails; // byte array
            }


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

            int localVarStatusCode = (int) localVarResponse.StatusCode;

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

            return new ApiResponse<Object>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                null);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">ID of the duty</param>
        /// <param name="dutyCostDetails">Costing Information</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <ASW.APIServices.Core.Client.ApiResponse <Object> > SendDutyCostingAsyncWithHttpInfo(string id, DutyCostDetails dutyCostDetails)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'id' when calling CostingApi->SendDutyCosting");
            }

            // verify the required parameter 'dutyCostDetails' is set
            if (dutyCostDetails == null)
            {
                throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'dutyCostDetails' when calling CostingApi->SendDutyCosting");
            }


            ASW.APIServices.Core.Client.RequestOptions localVarRequestOptions = new ASW.APIServices.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (id != null)
            {
                localVarRequestOptions.PathParameters.Add("id", ASW.APIServices.Core.Client.ClientUtils.ParameterToString(id)); // path parameter
            }
            localVarRequestOptions.Data = dutyCostDetails;


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <Object>("/duties/{id}/costing", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("SendDutyCosting", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="id">ID of the duty</param>
 /// <param name="dutyCostDetails">Costing Information</param>
 /// <returns>Task of void</returns>
 public async System.Threading.Tasks.Task SendDutyCostingAsync(string id, DutyCostDetails dutyCostDetails)
 {
     await SendDutyCostingAsyncWithHttpInfo(id, dutyCostDetails);
 }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="id">ID of the duty</param>
 /// <param name="dutyCostDetails">Costing Information</param>
 /// <returns></returns>
 public void SendDutyCosting(string id, DutyCostDetails dutyCostDetails)
 {
     SendDutyCostingWithHttpInfo(id, dutyCostDetails);
 }
Пример #5
0
        public virtual IActionResult SendDutyCosting([FromRoute][Required] string id, [FromBody] DutyCostDetails dutyCostDetails)
        {
            //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(200);
            //TODO: Uncomment the next line to return response 202 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(202, default(AsyncResponse));

            throw new NotImplementedException();
        }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">ID of the duty</param>
        /// <param name="dutyCostDetails">Costing Information</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public ASW.APIServices.Core.Client.ApiResponse <Object> SendDutyCostingWithHttpInfo(string id, DutyCostDetails dutyCostDetails)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'id' when calling DutiesApi->SendDutyCosting");
            }

            // verify the required parameter 'dutyCostDetails' is set
            if (dutyCostDetails == null)
            {
                throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'dutyCostDetails' when calling DutiesApi->SendDutyCosting");
            }

            ASW.APIServices.Core.Client.RequestOptions localVarRequestOptions = new ASW.APIServices.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            var localVarContentType = ASW.APIServices.Core.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = ASW.APIServices.Core.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (id != null)
            {
                localVarRequestOptions.PathParameters.Add("id", ASW.APIServices.Core.Client.ClientUtils.ParameterToString(id)); // path parameter
            }
            localVarRequestOptions.Data = dutyCostDetails;


            // make the HTTP request
            var localVarResponse = this.Client.Post <Object>("/duties/{id}/costing", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("SendDutyCosting", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }