<?php
/**
 * FortnoxPricesApi
 * PHP version 8.1
 *
 * @category Class
 * @package  Fortnox
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Fortnox API
 *
 * # Documentation   The Fortnox API is organized around REST. This means that we’ve designed it to have resource-oriented URLs and be as predictable as possible for you as developer.  It also means that we use HTTP status codes when something goes wrong and HTTP verbs understod by many API clients around the web.  We use a modified version of OAuth2 for authentication to offer a secure way for both you and our users to interact.  The API is generally built to support both XML and JSON but in this documentation all the examples will be in JSON.  We encourage you to read all the articles in the [Guides & Good to Know section](https://www.fortnox.se/developer/guides-and-good-to-know/)</a> first, before going forward and learning about the different resources.  This to ensure you get an understanding of some of the shared components of the API such as parameters and error handling.  ## Rate limits  The limit per access-token is 25 requests per 5 seconds. This equals to 300 requests per minute.  [Read more about this here.](https://www.fortnox.se/developer/guides-and-good-to-know/rate-limits-for-fortnox-api/)  ## Query parameters  Use query parameters with the ?-character and separate parameters with the &-character.   **Example:**  GET - https://api.fortnox.se/3/invoices?accountnumberfrom=3000&accountnumberto=4000 Read more about our parameters [here](https://www.fortnox.se/developer/guides-and-good-to-know/parameters/)   Search the documentation using the search field in the top left corner.
 *
 * The version of the OpenAPI document: 
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.19.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Fortnox\Api;

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Fortnox\ApiException;
use Fortnox\Configuration;
use Fortnox\FormDataProcessor;
use Fortnox\HeaderSelector;
use Fortnox\ObjectSerializer;

/**
 * FortnoxPricesApi Class Doc Comment
 *
 * @category Class
 * @package  Fortnox
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */
class FortnoxPricesApi
{
    /**
     * @var ClientInterface
     */
    protected $client;

    /**
     * @var Configuration
     */
    protected $config;

    /**
     * @var HeaderSelector
     */
    protected $headerSelector;

    /**
     * @var int Host index
     */
    protected $hostIndex;

    /** @var string[] $contentTypes **/
    public const contentTypes = [
        'priceControllerDoCreate' => [
            'application/json',
        ],
        'priceControllerDoDeleteWithId3' => [
            'application/json',
        ],
        'priceControllerDoIndex' => [
            'application/json',
        ],
        'priceControllerDoShow' => [
            'application/json',
        ],
        'priceControllerDoShowWithId3' => [
            'application/json',
        ],
        'priceControllerDoSublistWithTwoParams' => [
            'application/json',
        ],
        'priceControllerDoUpdate' => [
            'application/json',
        ],
        'priceControllerDoUpdateWithId3' => [
            'application/json',
        ],
    ];

    /**
     * @param ClientInterface $client
     * @param Configuration   $config
     * @param HeaderSelector  $selector
     * @param int             $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
     */
    public function __construct(
        ?ClientInterface $client = null,
        ?Configuration $config = null,
        ?HeaderSelector $selector = null,
        int $hostIndex = 0
    ) {
        $this->client = $client ?: new Client();
        $this->config = $config ?: Configuration::getDefaultConfiguration();
        $this->headerSelector = $selector ?: new HeaderSelector();
        $this->hostIndex = $hostIndex;
    }

    /**
     * Set the host index
     *
     * @param int $hostIndex Host index (required)
     */
    public function setHostIndex($hostIndex): void
    {
        $this->hostIndex = $hostIndex;
    }

    /**
     * Get the host index
     *
     * @return int Host index
     */
    public function getHostIndex()
    {
        return $this->hostIndex;
    }

    /**
     * @return Configuration
     */
    public function getConfig()
    {
        return $this->config;
    }

    /**
     * Operation priceControllerDoCreate
     *
     * Create a price
     *
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for create price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoCreate'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap
     */
    public function priceControllerDoCreate($price = null, string $contentType = self::contentTypes['priceControllerDoCreate'][0])
    {
        list($response) = $this->priceControllerDoCreateWithHttpInfo($price, $contentType);
        return $response;
    }

    /**
     * Operation priceControllerDoCreateWithHttpInfo
     *
     * Create a price
     *
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for create price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoCreate'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoCreateWithHttpInfo($price = null, string $contentType = self::contentTypes['priceControllerDoCreate'][0])
    {
        $request = $this->priceControllerDoCreateRequest($price, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            switch($statusCode) {
                case 201:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $request,
                        $response,
                    );
                default:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
            }

            

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }

            return $this->handleResponseWithDataType(
                '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                $request,
                $response,
            );
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 201:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoCreateAsync
     *
     * Create a price
     *
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for create price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoCreate'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoCreateAsync($price = null, string $contentType = self::contentTypes['priceControllerDoCreate'][0])
    {
        return $this->priceControllerDoCreateAsyncWithHttpInfo($price, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoCreateAsyncWithHttpInfo
     *
     * Create a price
     *
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for create price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoCreate'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoCreateAsyncWithHttpInfo($price = null, string $contentType = self::contentTypes['priceControllerDoCreate'][0])
    {
        $returnType = '\Fortnox\Model\FortnoxPriceSingleItemWrap';
        $request = $this->priceControllerDoCreateRequest($price, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); //stream goes to serializer
                    } else {
                        $content = (string) $response->getBody();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoCreate'
     *
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for create price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoCreate'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoCreateRequest($price = null, string $contentType = self::contentTypes['priceControllerDoCreate'][0])
    {



        $resourcePath = '/3/prices';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;





        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (isset($price)) {
            if (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the body
                $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($price));
            } else {
                $httpBody = $price;
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'POST',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation priceControllerDoDeleteWithId3
     *
     * Delete a single price
     *
     * @param  string $price_list Price list to delete from (required)
     * @param  string $article_number Number of article to delete the price for (required)
     * @param  string $from_quantity From quantity of price to delete (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoDeleteWithId3'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return void
     */
    public function priceControllerDoDeleteWithId3($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoDeleteWithId3'][0])
    {
        $this->priceControllerDoDeleteWithId3WithHttpInfo($price_list, $article_number, $from_quantity, $contentType);
    }

    /**
     * Operation priceControllerDoDeleteWithId3WithHttpInfo
     *
     * Delete a single price
     *
     * @param  string $price_list Price list to delete from (required)
     * @param  string $article_number Number of article to delete the price for (required)
     * @param  string $from_quantity From quantity of price to delete (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoDeleteWithId3'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of null, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoDeleteWithId3WithHttpInfo($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoDeleteWithId3'][0])
    {
        $request = $this->priceControllerDoDeleteWithId3Request($price_list, $article_number, $from_quantity, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            return [null, $statusCode, $response->getHeaders()];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 404:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoDeleteWithId3Async
     *
     * Delete a single price
     *
     * @param  string $price_list Price list to delete from (required)
     * @param  string $article_number Number of article to delete the price for (required)
     * @param  string $from_quantity From quantity of price to delete (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoDeleteWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoDeleteWithId3Async($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoDeleteWithId3'][0])
    {
        return $this->priceControllerDoDeleteWithId3AsyncWithHttpInfo($price_list, $article_number, $from_quantity, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoDeleteWithId3AsyncWithHttpInfo
     *
     * Delete a single price
     *
     * @param  string $price_list Price list to delete from (required)
     * @param  string $article_number Number of article to delete the price for (required)
     * @param  string $from_quantity From quantity of price to delete (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoDeleteWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoDeleteWithId3AsyncWithHttpInfo($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoDeleteWithId3'][0])
    {
        $returnType = '';
        $request = $this->priceControllerDoDeleteWithId3Request($price_list, $article_number, $from_quantity, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoDeleteWithId3'
     *
     * @param  string $price_list Price list to delete from (required)
     * @param  string $article_number Number of article to delete the price for (required)
     * @param  string $from_quantity From quantity of price to delete (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoDeleteWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoDeleteWithId3Request($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoDeleteWithId3'][0])
    {

        // verify the required parameter 'price_list' is set
        if ($price_list === null || (is_array($price_list) && count($price_list) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $price_list when calling priceControllerDoDeleteWithId3'
            );
        }

        // verify the required parameter 'article_number' is set
        if ($article_number === null || (is_array($article_number) && count($article_number) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $article_number when calling priceControllerDoDeleteWithId3'
            );
        }

        // verify the required parameter 'from_quantity' is set
        if ($from_quantity === null || (is_array($from_quantity) && count($from_quantity) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $from_quantity when calling priceControllerDoDeleteWithId3'
            );
        }


        $resourcePath = '/3/prices/{PriceList}/{ArticleNumber}/{FromQuantity}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;



        // path params
        if ($price_list !== null) {
            $resourcePath = str_replace(
                '{' . 'PriceList' . '}',
                ObjectSerializer::toPathValue($price_list),
                $resourcePath
            );
        }
        // path params
        if ($article_number !== null) {
            $resourcePath = str_replace(
                '{' . 'ArticleNumber' . '}',
                ObjectSerializer::toPathValue($article_number),
                $resourcePath
            );
        }
        // path params
        if ($from_quantity !== null) {
            $resourcePath = str_replace(
                '{' . 'FromQuantity' . '}',
                ObjectSerializer::toPathValue($from_quantity),
                $resourcePath
            );
        }


        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'DELETE',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation priceControllerDoIndex
     *
     * Retrieve a list of prices
     *
     * @param  float|null $fromquantity Lists prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoIndex'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap
     */
    public function priceControllerDoIndex($fromquantity = null, string $contentType = self::contentTypes['priceControllerDoIndex'][0])
    {
        list($response) = $this->priceControllerDoIndexWithHttpInfo($fromquantity, $contentType);
        return $response;
    }

    /**
     * Operation priceControllerDoIndexWithHttpInfo
     *
     * Retrieve a list of prices
     *
     * @param  float|null $fromquantity Lists prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoIndex'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoIndexWithHttpInfo($fromquantity = null, string $contentType = self::contentTypes['priceControllerDoIndex'][0])
    {
        $request = $this->priceControllerDoIndexRequest($fromquantity, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            switch($statusCode) {
                case 200:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $request,
                        $response,
                    );
                case 400:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
                default:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
            }

            

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }

            return $this->handleResponseWithDataType(
                '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                $request,
                $response,
            );
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoIndexAsync
     *
     * Retrieve a list of prices
     *
     * @param  float|null $fromquantity Lists prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoIndex'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoIndexAsync($fromquantity = null, string $contentType = self::contentTypes['priceControllerDoIndex'][0])
    {
        return $this->priceControllerDoIndexAsyncWithHttpInfo($fromquantity, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoIndexAsyncWithHttpInfo
     *
     * Retrieve a list of prices
     *
     * @param  float|null $fromquantity Lists prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoIndex'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoIndexAsyncWithHttpInfo($fromquantity = null, string $contentType = self::contentTypes['priceControllerDoIndex'][0])
    {
        $returnType = '\Fortnox\Model\FortnoxPriceSingleItemWrap';
        $request = $this->priceControllerDoIndexRequest($fromquantity, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); //stream goes to serializer
                    } else {
                        $content = (string) $response->getBody();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoIndex'
     *
     * @param  float|null $fromquantity Lists prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoIndex'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoIndexRequest($fromquantity = null, string $contentType = self::contentTypes['priceControllerDoIndex'][0])
    {



        $resourcePath = '/3/prices';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $fromquantity,
            'fromquantity', // param base name
            'number', // openApiType
            'form', // style
            true, // explode
            false // required
        ) ?? []);




        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'GET',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation priceControllerDoShow
     *
     * Retrieve the first price for the specified article
     *
     * @param  string $price_list Price list of the price to show (required)
     * @param  string $article_number Article number of the price to show (required)
     * @param  float|null $fromquantity Get price by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShow'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap
     */
    public function priceControllerDoShow($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoShow'][0])
    {
        list($response) = $this->priceControllerDoShowWithHttpInfo($price_list, $article_number, $fromquantity, $contentType);
        return $response;
    }

    /**
     * Operation priceControllerDoShowWithHttpInfo
     *
     * Retrieve the first price for the specified article
     *
     * @param  string $price_list Price list of the price to show (required)
     * @param  string $article_number Article number of the price to show (required)
     * @param  float|null $fromquantity Get price by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShow'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoShowWithHttpInfo($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoShow'][0])
    {
        $request = $this->priceControllerDoShowRequest($price_list, $article_number, $fromquantity, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            switch($statusCode) {
                case 200:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $request,
                        $response,
                    );
                case 404:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
                default:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
            }

            

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }

            return $this->handleResponseWithDataType(
                '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                $request,
                $response,
            );
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 404:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoShowAsync
     *
     * Retrieve the first price for the specified article
     *
     * @param  string $price_list Price list of the price to show (required)
     * @param  string $article_number Article number of the price to show (required)
     * @param  float|null $fromquantity Get price by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShow'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoShowAsync($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoShow'][0])
    {
        return $this->priceControllerDoShowAsyncWithHttpInfo($price_list, $article_number, $fromquantity, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoShowAsyncWithHttpInfo
     *
     * Retrieve the first price for the specified article
     *
     * @param  string $price_list Price list of the price to show (required)
     * @param  string $article_number Article number of the price to show (required)
     * @param  float|null $fromquantity Get price by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShow'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoShowAsyncWithHttpInfo($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoShow'][0])
    {
        $returnType = '\Fortnox\Model\FortnoxPriceSingleItemWrap';
        $request = $this->priceControllerDoShowRequest($price_list, $article_number, $fromquantity, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); //stream goes to serializer
                    } else {
                        $content = (string) $response->getBody();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoShow'
     *
     * @param  string $price_list Price list of the price to show (required)
     * @param  string $article_number Article number of the price to show (required)
     * @param  float|null $fromquantity Get price by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShow'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoShowRequest($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoShow'][0])
    {

        // verify the required parameter 'price_list' is set
        if ($price_list === null || (is_array($price_list) && count($price_list) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $price_list when calling priceControllerDoShow'
            );
        }

        // verify the required parameter 'article_number' is set
        if ($article_number === null || (is_array($article_number) && count($article_number) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $article_number when calling priceControllerDoShow'
            );
        }



        $resourcePath = '/3/prices/{PriceList}/{ArticleNumber}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $fromquantity,
            'fromquantity', // param base name
            'number', // openApiType
            'form', // style
            true, // explode
            false // required
        ) ?? []);


        // path params
        if ($price_list !== null) {
            $resourcePath = str_replace(
                '{' . 'PriceList' . '}',
                ObjectSerializer::toPathValue($price_list),
                $resourcePath
            );
        }
        // path params
        if ($article_number !== null) {
            $resourcePath = str_replace(
                '{' . 'ArticleNumber' . '}',
                ObjectSerializer::toPathValue($article_number),
                $resourcePath
            );
        }


        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'GET',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation priceControllerDoShowWithId3
     *
     * Retrieve a price for a specified article
     *
     * @param  string $price_list Price list to get the price from (required)
     * @param  string $article_number Number of article to get the price for (required)
     * @param  string $from_quantity From quantity of price to show (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShowWithId3'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap
     */
    public function priceControllerDoShowWithId3($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoShowWithId3'][0])
    {
        list($response) = $this->priceControllerDoShowWithId3WithHttpInfo($price_list, $article_number, $from_quantity, $contentType);
        return $response;
    }

    /**
     * Operation priceControllerDoShowWithId3WithHttpInfo
     *
     * Retrieve a price for a specified article
     *
     * @param  string $price_list Price list to get the price from (required)
     * @param  string $article_number Number of article to get the price for (required)
     * @param  string $from_quantity From quantity of price to show (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShowWithId3'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoShowWithId3WithHttpInfo($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoShowWithId3'][0])
    {
        $request = $this->priceControllerDoShowWithId3Request($price_list, $article_number, $from_quantity, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            switch($statusCode) {
                case 200:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $request,
                        $response,
                    );
                case 400:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
                case 404:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
                default:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
            }

            

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }

            return $this->handleResponseWithDataType(
                '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                $request,
                $response,
            );
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 404:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoShowWithId3Async
     *
     * Retrieve a price for a specified article
     *
     * @param  string $price_list Price list to get the price from (required)
     * @param  string $article_number Number of article to get the price for (required)
     * @param  string $from_quantity From quantity of price to show (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShowWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoShowWithId3Async($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoShowWithId3'][0])
    {
        return $this->priceControllerDoShowWithId3AsyncWithHttpInfo($price_list, $article_number, $from_quantity, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoShowWithId3AsyncWithHttpInfo
     *
     * Retrieve a price for a specified article
     *
     * @param  string $price_list Price list to get the price from (required)
     * @param  string $article_number Number of article to get the price for (required)
     * @param  string $from_quantity From quantity of price to show (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShowWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoShowWithId3AsyncWithHttpInfo($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoShowWithId3'][0])
    {
        $returnType = '\Fortnox\Model\FortnoxPriceSingleItemWrap';
        $request = $this->priceControllerDoShowWithId3Request($price_list, $article_number, $from_quantity, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); //stream goes to serializer
                    } else {
                        $content = (string) $response->getBody();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoShowWithId3'
     *
     * @param  string $price_list Price list to get the price from (required)
     * @param  string $article_number Number of article to get the price for (required)
     * @param  string $from_quantity From quantity of price to show (required)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoShowWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoShowWithId3Request($price_list, $article_number, $from_quantity, string $contentType = self::contentTypes['priceControllerDoShowWithId3'][0])
    {

        // verify the required parameter 'price_list' is set
        if ($price_list === null || (is_array($price_list) && count($price_list) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $price_list when calling priceControllerDoShowWithId3'
            );
        }

        // verify the required parameter 'article_number' is set
        if ($article_number === null || (is_array($article_number) && count($article_number) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $article_number when calling priceControllerDoShowWithId3'
            );
        }

        // verify the required parameter 'from_quantity' is set
        if ($from_quantity === null || (is_array($from_quantity) && count($from_quantity) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $from_quantity when calling priceControllerDoShowWithId3'
            );
        }


        $resourcePath = '/3/prices/{PriceList}/{ArticleNumber}/{FromQuantity}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;



        // path params
        if ($price_list !== null) {
            $resourcePath = str_replace(
                '{' . 'PriceList' . '}',
                ObjectSerializer::toPathValue($price_list),
                $resourcePath
            );
        }
        // path params
        if ($article_number !== null) {
            $resourcePath = str_replace(
                '{' . 'ArticleNumber' . '}',
                ObjectSerializer::toPathValue($article_number),
                $resourcePath
            );
        }
        // path params
        if ($from_quantity !== null) {
            $resourcePath = str_replace(
                '{' . 'FromQuantity' . '}',
                ObjectSerializer::toPathValue($from_quantity),
                $resourcePath
            );
        }


        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'GET',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation priceControllerDoSublistWithTwoParams
     *
     * Retrieve a list of articles with all their prices in the specified price list
     *
     * @param  string $price_list Price list of the prices to list (required)
     * @param  string $article_number Article number of the prices to list (required)
     * @param  float|null $fromquantity Filter prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoSublistWithTwoParams'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return \Fortnox\Model\FortnoxPriceListItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap
     */
    public function priceControllerDoSublistWithTwoParams($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoSublistWithTwoParams'][0])
    {
        list($response) = $this->priceControllerDoSublistWithTwoParamsWithHttpInfo($price_list, $article_number, $fromquantity, $contentType);
        return $response;
    }

    /**
     * Operation priceControllerDoSublistWithTwoParamsWithHttpInfo
     *
     * Retrieve a list of articles with all their prices in the specified price list
     *
     * @param  string $price_list Price list of the prices to list (required)
     * @param  string $article_number Article number of the prices to list (required)
     * @param  float|null $fromquantity Filter prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoSublistWithTwoParams'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of \Fortnox\Model\FortnoxPriceListItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoSublistWithTwoParamsWithHttpInfo($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoSublistWithTwoParams'][0])
    {
        $request = $this->priceControllerDoSublistWithTwoParamsRequest($price_list, $article_number, $fromquantity, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            switch($statusCode) {
                case 200:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxPriceListItemWrap',
                        $request,
                        $response,
                    );
                default:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
            }

            

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }

            return $this->handleResponseWithDataType(
                '\Fortnox\Model\FortnoxPriceListItemWrap',
                $request,
                $response,
            );
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxPriceListItemWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoSublistWithTwoParamsAsync
     *
     * Retrieve a list of articles with all their prices in the specified price list
     *
     * @param  string $price_list Price list of the prices to list (required)
     * @param  string $article_number Article number of the prices to list (required)
     * @param  float|null $fromquantity Filter prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoSublistWithTwoParams'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoSublistWithTwoParamsAsync($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoSublistWithTwoParams'][0])
    {
        return $this->priceControllerDoSublistWithTwoParamsAsyncWithHttpInfo($price_list, $article_number, $fromquantity, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoSublistWithTwoParamsAsyncWithHttpInfo
     *
     * Retrieve a list of articles with all their prices in the specified price list
     *
     * @param  string $price_list Price list of the prices to list (required)
     * @param  string $article_number Article number of the prices to list (required)
     * @param  float|null $fromquantity Filter prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoSublistWithTwoParams'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoSublistWithTwoParamsAsyncWithHttpInfo($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoSublistWithTwoParams'][0])
    {
        $returnType = '\Fortnox\Model\FortnoxPriceListItemWrap';
        $request = $this->priceControllerDoSublistWithTwoParamsRequest($price_list, $article_number, $fromquantity, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); //stream goes to serializer
                    } else {
                        $content = (string) $response->getBody();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoSublistWithTwoParams'
     *
     * @param  string $price_list Price list of the prices to list (required)
     * @param  string $article_number Article number of the prices to list (required)
     * @param  float|null $fromquantity Filter prices by from quantity (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoSublistWithTwoParams'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoSublistWithTwoParamsRequest($price_list, $article_number, $fromquantity = null, string $contentType = self::contentTypes['priceControllerDoSublistWithTwoParams'][0])
    {

        // verify the required parameter 'price_list' is set
        if ($price_list === null || (is_array($price_list) && count($price_list) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $price_list when calling priceControllerDoSublistWithTwoParams'
            );
        }

        // verify the required parameter 'article_number' is set
        if ($article_number === null || (is_array($article_number) && count($article_number) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $article_number when calling priceControllerDoSublistWithTwoParams'
            );
        }



        $resourcePath = '/3/prices/sublist/{PriceList}/{ArticleNumber}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;

        // query params
        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
            $fromquantity,
            'fromquantity', // param base name
            'number', // openApiType
            'form', // style
            true, // explode
            false // required
        ) ?? []);


        // path params
        if ($price_list !== null) {
            $resourcePath = str_replace(
                '{' . 'PriceList' . '}',
                ObjectSerializer::toPathValue($price_list),
                $resourcePath
            );
        }
        // path params
        if ($article_number !== null) {
            $resourcePath = str_replace(
                '{' . 'ArticleNumber' . '}',
                ObjectSerializer::toPathValue($article_number),
                $resourcePath
            );
        }


        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'GET',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation priceControllerDoUpdate
     *
     * Update the first price in the specified article
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdate'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap
     */
    public function priceControllerDoUpdate($price_list, $article_number, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdate'][0])
    {
        list($response) = $this->priceControllerDoUpdateWithHttpInfo($price_list, $article_number, $price, $contentType);
        return $response;
    }

    /**
     * Operation priceControllerDoUpdateWithHttpInfo
     *
     * Update the first price in the specified article
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdate'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoUpdateWithHttpInfo($price_list, $article_number, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdate'][0])
    {
        $request = $this->priceControllerDoUpdateRequest($price_list, $article_number, $price, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            switch($statusCode) {
                case 200:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $request,
                        $response,
                    );
                case 404:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
                default:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
            }

            

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }

            return $this->handleResponseWithDataType(
                '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                $request,
                $response,
            );
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 404:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoUpdateAsync
     *
     * Update the first price in the specified article
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdate'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoUpdateAsync($price_list, $article_number, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdate'][0])
    {
        return $this->priceControllerDoUpdateAsyncWithHttpInfo($price_list, $article_number, $price, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoUpdateAsyncWithHttpInfo
     *
     * Update the first price in the specified article
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdate'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoUpdateAsyncWithHttpInfo($price_list, $article_number, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdate'][0])
    {
        $returnType = '\Fortnox\Model\FortnoxPriceSingleItemWrap';
        $request = $this->priceControllerDoUpdateRequest($price_list, $article_number, $price, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); //stream goes to serializer
                    } else {
                        $content = (string) $response->getBody();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoUpdate'
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdate'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoUpdateRequest($price_list, $article_number, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdate'][0])
    {

        // verify the required parameter 'price_list' is set
        if ($price_list === null || (is_array($price_list) && count($price_list) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $price_list when calling priceControllerDoUpdate'
            );
        }

        // verify the required parameter 'article_number' is set
        if ($article_number === null || (is_array($article_number) && count($article_number) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $article_number when calling priceControllerDoUpdate'
            );
        }



        $resourcePath = '/3/prices/{PriceList}/{ArticleNumber}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;



        // path params
        if ($price_list !== null) {
            $resourcePath = str_replace(
                '{' . 'PriceList' . '}',
                ObjectSerializer::toPathValue($price_list),
                $resourcePath
            );
        }
        // path params
        if ($article_number !== null) {
            $resourcePath = str_replace(
                '{' . 'ArticleNumber' . '}',
                ObjectSerializer::toPathValue($article_number),
                $resourcePath
            );
        }


        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (isset($price)) {
            if (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the body
                $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($price));
            } else {
                $httpBody = $price;
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'PUT',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Operation priceControllerDoUpdateWithId3
     *
     * Update a price
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  string $from_quantity From quantity of price to update (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdateWithId3'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap
     */
    public function priceControllerDoUpdateWithId3($price_list, $article_number, $from_quantity, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdateWithId3'][0])
    {
        list($response) = $this->priceControllerDoUpdateWithId3WithHttpInfo($price_list, $article_number, $from_quantity, $price, $contentType);
        return $response;
    }

    /**
     * Operation priceControllerDoUpdateWithId3WithHttpInfo
     *
     * Update a price
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  string $from_quantity From quantity of price to update (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdateWithId3'] to see the possible values for this operation
     *
     * @throws \Fortnox\ApiException on non-2xx response or if the response body is not in the expected format
     * @throws \InvalidArgumentException
     * @return array of \Fortnox\Model\FortnoxPriceSingleItemWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap|\Fortnox\Model\FortnoxErrorInformationWrap, HTTP status code, HTTP response headers (array of strings)
     */
    public function priceControllerDoUpdateWithId3WithHttpInfo($price_list, $article_number, $from_quantity, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdateWithId3'][0])
    {
        $request = $this->priceControllerDoUpdateWithId3Request($price_list, $article_number, $from_quantity, $price, $contentType);

        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }

            $statusCode = $response->getStatusCode();


            switch($statusCode) {
                case 200:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $request,
                        $response,
                    );
                case 400:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
                case 404:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
                default:
                    return $this->handleResponseWithDataType(
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $request,
                        $response,
                    );
            }

            

            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }

            return $this->handleResponseWithDataType(
                '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                $request,
                $response,
            );
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxPriceSingleItemWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 400:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                case 404:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
                default:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        '\Fortnox\Model\FortnoxErrorInformationWrap',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    throw $e;
            }
        

            throw $e;
        }
    }

    /**
     * Operation priceControllerDoUpdateWithId3Async
     *
     * Update a price
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  string $from_quantity From quantity of price to update (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdateWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoUpdateWithId3Async($price_list, $article_number, $from_quantity, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdateWithId3'][0])
    {
        return $this->priceControllerDoUpdateWithId3AsyncWithHttpInfo($price_list, $article_number, $from_quantity, $price, $contentType)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }

    /**
     * Operation priceControllerDoUpdateWithId3AsyncWithHttpInfo
     *
     * Update a price
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  string $from_quantity From quantity of price to update (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdateWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
    public function priceControllerDoUpdateWithId3AsyncWithHttpInfo($price_list, $article_number, $from_quantity, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdateWithId3'][0])
    {
        $returnType = '\Fortnox\Model\FortnoxPriceSingleItemWrap';
        $request = $this->priceControllerDoUpdateWithId3Request($price_list, $article_number, $from_quantity, $price, $contentType);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); //stream goes to serializer
                    } else {
                        $content = (string) $response->getBody();
                        if ($returnType !== 'string') {
                            $content = json_decode($content);
                        }
                    }

                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }

    /**
     * Create request for operation 'priceControllerDoUpdateWithId3'
     *
     * @param  string $price_list Price list to update the price for (required)
     * @param  string $article_number Number of article to update the price for (required)
     * @param  string $from_quantity From quantity of price to update (required)
     * @param  \Fortnox\Model\FortnoxPriceSinglePayloadItemWrap|null $price Request body for update price (optional)
     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['priceControllerDoUpdateWithId3'] to see the possible values for this operation
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
    public function priceControllerDoUpdateWithId3Request($price_list, $article_number, $from_quantity, $price = null, string $contentType = self::contentTypes['priceControllerDoUpdateWithId3'][0])
    {

        // verify the required parameter 'price_list' is set
        if ($price_list === null || (is_array($price_list) && count($price_list) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $price_list when calling priceControllerDoUpdateWithId3'
            );
        }

        // verify the required parameter 'article_number' is set
        if ($article_number === null || (is_array($article_number) && count($article_number) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $article_number when calling priceControllerDoUpdateWithId3'
            );
        }

        // verify the required parameter 'from_quantity' is set
        if ($from_quantity === null || (is_array($from_quantity) && count($from_quantity) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $from_quantity when calling priceControllerDoUpdateWithId3'
            );
        }



        $resourcePath = '/3/prices/{PriceList}/{ArticleNumber}/{FromQuantity}';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;



        // path params
        if ($price_list !== null) {
            $resourcePath = str_replace(
                '{' . 'PriceList' . '}',
                ObjectSerializer::toPathValue($price_list),
                $resourcePath
            );
        }
        // path params
        if ($article_number !== null) {
            $resourcePath = str_replace(
                '{' . 'ArticleNumber' . '}',
                ObjectSerializer::toPathValue($article_number),
                $resourcePath
            );
        }
        // path params
        if ($from_quantity !== null) {
            $resourcePath = str_replace(
                '{' . 'FromQuantity' . '}',
                ObjectSerializer::toPathValue($from_quantity),
                $resourcePath
            );
        }


        $headers = $this->headerSelector->selectHeaders(
            ['application/json', ],
            $contentType,
            $multipart
        );

        // for model (json/xml)
        if (isset($price)) {
            if (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the body
                $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($price));
            } else {
                $httpBody = $price;
            }
        } elseif (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                // for HTTP post (form)
                $httpBody = new MultipartStream($multipartContents);

            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
                # if Content-Type contains "application/json", json_encode the form parameters
                $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
            } else {
                // for HTTP post (form)
                $httpBody = ObjectSerializer::buildQuery($formParams);
            }
        }


        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }

        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );

        $operationHost = $this->config->getHost();
        $query = ObjectSerializer::buildQuery($queryParams);
        return new Request(
            'PUT',
            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }

    /**
     * Create http client option
     *
     * @throws \RuntimeException on file opening failure
     * @return array of http client options
     */
    protected function createHttpClientOption()
    {
        $options = [];
        if ($this->config->getDebug()) {
            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
            if (!$options[RequestOptions::DEBUG]) {
                throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
            }
        }

        if ($this->config->getCertFile()) {
            $options[RequestOptions::CERT] = $this->config->getCertFile();
        }

        if ($this->config->getKeyFile()) {
            $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
        }

        return $options;
    }

    private function handleResponseWithDataType(
        string $dataType,
        RequestInterface $request,
        ResponseInterface $response
    ): array {
        if ($dataType === '\SplFileObject') {
            $content = $response->getBody(); //stream goes to serializer
        } else {
            $content = (string) $response->getBody();
            if ($dataType !== 'string') {
                try {
                    $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
                } catch (\JsonException $exception) {
                    throw new ApiException(
                        sprintf(
                            'Error JSON decoding server response (%s)',
                            $request->getUri()
                        ),
                        $response->getStatusCode(),
                        $response->getHeaders(),
                        $content
                    );
                }
            }
        }

        return [
            ObjectSerializer::deserialize($content, $dataType, []),
            $response->getStatusCode(),
            $response->getHeaders()
        ];
    }

    private function responseWithinRangeCode(
        string $rangeCode,
        int $statusCode
    ): bool {
        $left = (int) ($rangeCode[0].'00');
        $right = (int) ($rangeCode[0].'99');

        return $statusCode >= $left && $statusCode <= $right;
    }
}
