/// <summary>
        /// Aggiunge una aoo (ditta) al contratto
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="aoo"></param>
        /// <param name="xAuthorization">access_token</param>
        /// <returns>Task of AooResponse</returns>
        public async System.Threading.Tasks.Task <AooResponse> InsertAooAsync(string id, CreateAooRequest aoo, string xAuthorization)
        {
            ApiResponse <AooResponse> localVarResponse = await InsertAooAsyncWithHttpInfo(id, aoo, xAuthorization);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Aggiunge una aoo (ditta) al contratto
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="aoo"></param>
        /// <param name="xAuthorization">access_token</param>
        /// <returns>Task of ApiResponse (AooResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <AooResponse> > InsertAooAsyncWithHttpInfo(string id, CreateAooRequest aoo, string xAuthorization)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling ContrattiAoosApi->InsertAoo");
            }
            // verify the required parameter 'aoo' is set
            if (aoo == null)
            {
                throw new ApiException(400, "Missing required parameter 'aoo' when calling ContrattiAoosApi->InsertAoo");
            }
            // verify the required parameter 'xAuthorization' is set
            if (xAuthorization == null)
            {
                throw new ApiException(400, "Missing required parameter 'xAuthorization' when calling ContrattiAoosApi->InsertAoo");
            }

            var    localVarPath         = "/api/v2/contratti/{id}/aoos";
            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",
                "text/json",
                "application/xml",
                "text/xml",
                "application/x-www-form-urlencoded"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml"
            };
            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 (xAuthorization != null)
            {
                localVarHeaderParams.Add("X-Authorization", this.Configuration.ApiClient.ParameterToString(xAuthorization));                         // header parameter
            }
            if (aoo != null && aoo.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(aoo); // http body (model) parameter
            }
            else
            {
                localVarPostBody = aoo; // 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("InsertAoo", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <AooResponse>(localVarStatusCode,
                                                 localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                 (AooResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AooResponse))));
        }
        /// <summary>
        /// Aggiunge una aoo (ditta) al contratto
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="aoo"></param>
        /// <param name="xAuthorization">access_token</param>
        /// <returns>AooResponse</returns>
        public AooResponse InsertAoo(string id, CreateAooRequest aoo, string xAuthorization)
        {
            ApiResponse <AooResponse> localVarResponse = InsertAooWithHttpInfo(id, aoo, xAuthorization);

            return(localVarResponse.Data);
        }