コード例 #1
0
        public virtual IActionResult CreateDuty([FromBody] DutyDetails dutyDetails)
        {
            //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
            // return StatusCode(200, default(string));
            //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));
            string exampleJson = null;

            var example = exampleJson != null
            ? JsonConvert.DeserializeObject <string>(exampleJson)
            : default(string);

            //TODO: Change the data returned
            return(new ObjectResult(example));
        }
コード例 #2
0
        /// <summary>
        ///  Create a new Duty
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="dutyDetails">Duty to be sent to agency</param>
        /// <returns>Task of ApiResponse (string)</returns>
        public async System.Threading.Tasks.Task <ASW.APIServices.Core.Client.ApiResponse <string> > CreateDutyAsyncWithHttpInfo(DutyDetails dutyDetails)
        {
            // verify the required parameter 'dutyDetails' is set
            if (dutyDetails == null)
            {
                throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'dutyDetails' when calling DutiesApi->CreateDuty");
            }


            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[] {
                "text/plain",
                "application/json"
            };

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

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

            localVarRequestOptions.Data = dutyDetails;


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <string>("/duties", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
コード例 #3
0
        /// <summary>
        ///  Create a new Duty
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="dutyDetails">Duty to be sent to agency</param>
        /// <returns>Task of string</returns>
        public async System.Threading.Tasks.Task <string> CreateDutyAsync(DutyDetails dutyDetails)
        {
            ASW.APIServices.Core.Client.ApiResponse <string> localVarResponse = await CreateDutyAsyncWithHttpInfo(dutyDetails);

            return(localVarResponse.Data);
        }
コード例 #4
0
        /// <summary>
        ///  Create a new Duty
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="dutyDetails">Duty to be sent to agency</param>
        /// <returns>ApiResponse of string</returns>
        public ASW.APIServices.Core.Client.ApiResponse <string> CreateDutyWithHttpInfo(DutyDetails dutyDetails)
        {
            // verify the required parameter 'dutyDetails' is set
            if (dutyDetails == null)
            {
                throw new ASW.APIServices.Core.Client.ApiException(400, "Missing required parameter 'dutyDetails' when calling DutiesApi->CreateDuty");
            }

            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[] {
                "text/plain",
                "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);
            }

            localVarRequestOptions.Data = dutyDetails;


            // make the HTTP request
            var localVarResponse = this.Client.Post <string>("/duties", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
コード例 #5
0
 /// <summary>
 ///  Create a new Duty
 /// </summary>
 /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="dutyDetails">Duty to be sent to agency</param>
 /// <returns>string</returns>
 public string CreateDuty(DutyDetails dutyDetails)
 {
     ASW.APIServices.Core.Client.ApiResponse <string> localVarResponse = CreateDutyWithHttpInfo(dutyDetails);
     return(localVarResponse.Data);
 }
コード例 #6
0
        /// <summary>
        ///  Create a new Duty
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="dutyDetails">Duty to be sent to agency</param>
        /// <returns>Task of ApiResponse (string)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <string> > CreateDutyAsyncWithHttpInfo(DutyDetails dutyDetails)
        {
            // verify the required parameter 'dutyDetails' is set
            if (dutyDetails == null)
            {
                throw new ApiException(400, "Missing required parameter 'dutyDetails' when calling Class3rdPartyRosteringApi->CreateDuty");
            }

            var    localVarPath         = "/duties";
            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[] {
                "text/plain",
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

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

            if (dutyDetails != null && dutyDetails.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(dutyDetails); // http body (model) parameter
            }
            else
            {
                localVarPostBody = dutyDetails; // 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("CreateDuty", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <string>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                            (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))));
        }
コード例 #7
0
        /// <summary>
        ///  Create a new Duty
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="dutyDetails">Duty to be sent to agency</param>
        /// <returns>string</returns>
        public string CreateDuty(DutyDetails dutyDetails)
        {
            ApiResponse <string> localVarResponse = CreateDutyWithHttpInfo(dutyDetails);

            return(localVarResponse.Data);
        }