/// <summary>
        /// Create The create operation creates a new product retirement.
        /// </summary>
        /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="spaceId"></param>
        /// <param name="retirement"></param>
        /// <returns>Task of SubscriptionProductRetirement</returns>
        public async System.Threading.Tasks.Task <SubscriptionProductRetirement> CreateAsync(long?spaceId, SubscriptionProductRetirementCreate retirement)
        {
            ApiResponse <SubscriptionProductRetirement> localVarResponse = await CreateAsyncWithHttpInfo(spaceId, retirement);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Create The create operation creates a new product retirement.
        /// </summary>
        /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="spaceId"></param>
        /// <param name="retirement"></param>
        /// <returns>Task of ApiResponse (SubscriptionProductRetirement)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <SubscriptionProductRetirement> > CreateAsyncWithHttpInfo(long?spaceId, SubscriptionProductRetirementCreate retirement)
        {
            // verify the required parameter 'spaceId' is set
            if (spaceId == null)
            {
                throw new ApiException(400, "Missing required parameter 'spaceId' when calling SubscriptionProductRetirementService->Create");
            }
            // verify the required parameter 'retirement' is set
            if (retirement == null)
            {
                throw new ApiException(400, "Missing required parameter 'retirement' when calling SubscriptionProductRetirementService->Create");
            }

            var    localVarPath         = "/subscription-product-retirement/create";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>();
            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;charset=utf-8"
            };
            String localVarHttpContentType = ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

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

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

            if (spaceId != null)
            {
                localVarQueryParams.Add("spaceId", ApiClient.ParameterToString(spaceId));                  // query parameter
            }
            if (retirement != null && retirement.GetType() != typeof(byte[]))
            {
                localVarPostBody = ApiClient.Serialize(retirement); // http body (model) parameter
            }
            else
            {
                localVarPostBody = retirement; // byte array
            }

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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <SubscriptionProductRetirement>(localVarStatusCode,
                                                                   localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                   (SubscriptionProductRetirement)ApiClient.Deserialize(localVarResponse, typeof(SubscriptionProductRetirement))));
        }
        /// <summary>
        /// Create The create operation creates a new product retirement.
        /// </summary>
        /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="spaceId"></param>
        /// <param name="retirement"></param>
        /// <returns>SubscriptionProductRetirement</returns>
        public SubscriptionProductRetirement Create(long?spaceId, SubscriptionProductRetirementCreate retirement)
        {
            ApiResponse <SubscriptionProductRetirement> localVarResponse = CreateWithHttpInfo(spaceId, retirement);

            return(localVarResponse.Data);
        }