<?php
/**
 * ContactsApi
 * PHP version 5
 *
 * @category Class
 * @package  SendinBlue\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * SendinBlue API
 *
 * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to :   - Manage your campaigns and get the statistics   - Manage your contacts   - Send transactional Emails and SMS   - and much more...  You can download our wrappers at https://github.com/orgs/sendinblue  **Possible responses**   | Code | Message |   | :-------------: | ------------- |   | 200  | OK. Successful Request  |   | 201  | OK. Successful Creation |   | 202  | OK. Request accepted |   | 204  | OK. Successful Update/Deletion  |   | 400  | Error. Bad Request  |   | 401  | Error. Authentication Needed  |   | 402  | Error. Not enough credit, plan upgrade needed  |   | 403  | Error. Permission denied  |   | 404  | Error. Object does not exist |   | 405  | Error. Method not allowed  |
 *
 * OpenAPI spec version: 3.0.0
 * Contact: contact@sendinblue.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace SendinBlue\Client\Api;

use \SendinBlue\Client\ApiClient;
use \SendinBlue\Client\ApiException;
use \SendinBlue\Client\Configuration;
use \SendinBlue\Client\ObjectSerializer;

/**
 * ContactsApi Class Doc Comment
 *
 * @category Class
 * @package  SendinBlue\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ContactsApi
{
    /**
     * API Client
     *
     * @var \SendinBlue\Client\ApiClient instance of the ApiClient
     */
    protected $apiClient;

    /**
     * Constructor
     *
     * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use
     */
    public function __construct(\SendinBlue\Client\ApiClient $apiClient = null)
    {
        if ($apiClient === null) {
            $apiClient = new ApiClient();
        }

        $this->apiClient = $apiClient;
    }

    /**
     * Get API client
     *
     * @return \SendinBlue\Client\ApiClient get the API client
     */
    public function getApiClient()
    {
        return $this->apiClient;
    }

    /**
     * Set the API client
     *
     * @param \SendinBlue\Client\ApiClient $apiClient set the API client
     *
     * @return ContactsApi
     */
    public function setApiClient(\SendinBlue\Client\ApiClient $apiClient)
    {
        $this->apiClient = $apiClient;
        return $this;
    }

    /**
     * Operation addContactToList
     *
     * Add existing contacts to a list
     *
     * @param int $listId Id of the list (required)
     * @param \SendinBlue\Client\Model\AddRemoveContactToList $contactEmails Emails addresses of the contacts (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\PostContactInfo
     */
    public function addContactToList($listId, $contactEmails)
    {
        list($response) = $this->addContactToListWithHttpInfo($listId, $contactEmails);
        return $response;
    }

    /**
     * Operation addContactToListWithHttpInfo
     *
     * Add existing contacts to a list
     *
     * @param int $listId Id of the list (required)
     * @param \SendinBlue\Client\Model\AddRemoveContactToList $contactEmails Emails addresses of the contacts (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings)
     */
    public function addContactToListWithHttpInfo($listId, $contactEmails)
    {
        // verify the required parameter 'listId' is set
        if ($listId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $listId when calling addContactToList');
        }
        // verify the required parameter 'contactEmails' is set
        if ($contactEmails === null) {
            throw new \InvalidArgumentException('Missing the required parameter $contactEmails when calling addContactToList');
        }
        // parse inputs
        $resourcePath = "/contacts/lists/{listId}/contacts/add";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($listId !== null) {
            $resourcePath = str_replace(
                "{" . "listId" . "}",
                $this->apiClient->getSerializer()->toPathValue($listId),
                $resourcePath
            );
        }
        // body params
        $_tempBody = null;
        if (isset($contactEmails)) {
            $_tempBody = $contactEmails;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\PostContactInfo',
                '/contacts/lists/{listId}/contacts/add'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\PostContactInfo', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 201:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostContactInfo', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation createAttribute
     *
     * Creates contact attributes
     *
     * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\CreateModel
     */
    public function createAttribute($createAttribute)
    {
        list($response) = $this->createAttributeWithHttpInfo($createAttribute);
        return $response;
    }

    /**
     * Operation createAttributeWithHttpInfo
     *
     * Creates contact attributes
     *
     * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
     */
    public function createAttributeWithHttpInfo($createAttribute)
    {
        // verify the required parameter 'createAttribute' is set
        if ($createAttribute === null) {
            throw new \InvalidArgumentException('Missing the required parameter $createAttribute when calling createAttribute');
        }
        // parse inputs
        $resourcePath = "/contacts/attributes";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // body params
        $_tempBody = null;
        if (isset($createAttribute)) {
            $_tempBody = $createAttribute;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\CreateModel',
                '/contacts/attributes'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 201:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation createContact
     *
     * Create a contact
     *
     * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\CreateModel
     */
    public function createContact($createContact)
    {
        list($response) = $this->createContactWithHttpInfo($createContact);
        return $response;
    }

    /**
     * Operation createContactWithHttpInfo
     *
     * Create a contact
     *
     * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
     */
    public function createContactWithHttpInfo($createContact)
    {
        // verify the required parameter 'createContact' is set
        if ($createContact === null) {
            throw new \InvalidArgumentException('Missing the required parameter $createContact when calling createContact');
        }
        // parse inputs
        $resourcePath = "/contacts";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // body params
        $_tempBody = null;
        if (isset($createContact)) {
            $_tempBody = $createContact;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\CreateModel',
                '/contacts'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 201:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation createFolder
     *
     * Create a folder
     *
     * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\CreateModel
     */
    public function createFolder($createFolder)
    {
        list($response) = $this->createFolderWithHttpInfo($createFolder);
        return $response;
    }

    /**
     * Operation createFolderWithHttpInfo
     *
     * Create a folder
     *
     * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
     */
    public function createFolderWithHttpInfo($createFolder)
    {
        // verify the required parameter 'createFolder' is set
        if ($createFolder === null) {
            throw new \InvalidArgumentException('Missing the required parameter $createFolder when calling createFolder');
        }
        // parse inputs
        $resourcePath = "/contacts/folders";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // body params
        $_tempBody = null;
        if (isset($createFolder)) {
            $_tempBody = $createFolder;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\CreateModel',
                '/contacts/folders'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 201:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation createList
     *
     * Create a list
     *
     * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\CreateModel
     */
    public function createList($createList)
    {
        list($response) = $this->createListWithHttpInfo($createList);
        return $response;
    }

    /**
     * Operation createListWithHttpInfo
     *
     * Create a list
     *
     * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
     */
    public function createListWithHttpInfo($createList)
    {
        // verify the required parameter 'createList' is set
        if ($createList === null) {
            throw new \InvalidArgumentException('Missing the required parameter $createList when calling createList');
        }
        // parse inputs
        $resourcePath = "/contacts/lists";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // body params
        $_tempBody = null;
        if (isset($createList)) {
            $_tempBody = $createList;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\CreateModel',
                '/contacts/lists'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 201:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation deleteAttribute
     *
     * Deletes an attribute
     *
     * @param int $attributeId id of the attribute (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return void
     */
    public function deleteAttribute($attributeId)
    {
        list($response) = $this->deleteAttributeWithHttpInfo($attributeId);
        return $response;
    }

    /**
     * Operation deleteAttributeWithHttpInfo
     *
     * Deletes an attribute
     *
     * @param int $attributeId id of the attribute (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of null, HTTP status code, HTTP response headers (array of strings)
     */
    public function deleteAttributeWithHttpInfo($attributeId)
    {
        // verify the required parameter 'attributeId' is set
        if ($attributeId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $attributeId when calling deleteAttribute');
        }
        // parse inputs
        $resourcePath = "/contacts/attributes/{attributeId}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($attributeId !== null) {
            $resourcePath = str_replace(
                "{" . "attributeId" . "}",
                $this->apiClient->getSerializer()->toPathValue($attributeId),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'DELETE',
                $queryParams,
                $httpBody,
                $headerParams,
                null,
                '/contacts/attributes/{attributeId}'
            );

            return [null, $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation deleteFolder
     *
     * Delete a folder (and all its lists)
     *
     * @param int $folderId Id of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return void
     */
    public function deleteFolder($folderId)
    {
        list($response) = $this->deleteFolderWithHttpInfo($folderId);
        return $response;
    }

    /**
     * Operation deleteFolderWithHttpInfo
     *
     * Delete a folder (and all its lists)
     *
     * @param int $folderId Id of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of null, HTTP status code, HTTP response headers (array of strings)
     */
    public function deleteFolderWithHttpInfo($folderId)
    {
        // verify the required parameter 'folderId' is set
        if ($folderId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $folderId when calling deleteFolder');
        }
        // parse inputs
        $resourcePath = "/contacts/folders/{folderId}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($folderId !== null) {
            $resourcePath = str_replace(
                "{" . "folderId" . "}",
                $this->apiClient->getSerializer()->toPathValue($folderId),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'DELETE',
                $queryParams,
                $httpBody,
                $headerParams,
                null,
                '/contacts/folders/{folderId}'
            );

            return [null, $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation deleteList
     *
     * Delete a list
     *
     * @param int $listId Id of the list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return void
     */
    public function deleteList($listId)
    {
        list($response) = $this->deleteListWithHttpInfo($listId);
        return $response;
    }

    /**
     * Operation deleteListWithHttpInfo
     *
     * Delete a list
     *
     * @param int $listId Id of the list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of null, HTTP status code, HTTP response headers (array of strings)
     */
    public function deleteListWithHttpInfo($listId)
    {
        // verify the required parameter 'listId' is set
        if ($listId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $listId when calling deleteList');
        }
        // parse inputs
        $resourcePath = "/contacts/lists/{listId}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($listId !== null) {
            $resourcePath = str_replace(
                "{" . "listId" . "}",
                $this->apiClient->getSerializer()->toPathValue($listId),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'DELETE',
                $queryParams,
                $httpBody,
                $headerParams,
                null,
                '/contacts/lists/{listId}'
            );

            return [null, $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getAttributes
     *
     * Lists all attributes
     *
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetAttributes
     */
    public function getAttributes()
    {
        list($response) = $this->getAttributesWithHttpInfo();
        return $response;
    }

    /**
     * Operation getAttributesWithHttpInfo
     *
     * Lists all attributes
     *
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetAttributes, HTTP status code, HTTP response headers (array of strings)
     */
    public function getAttributesWithHttpInfo()
    {
        // parse inputs
        $resourcePath = "/contacts/attributes";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);


        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetAttributes',
                '/contacts/attributes'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetAttributes', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetAttributes', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getContactInfo
     *
     * Retrieves contact informations
     *
     * @param string $email Email (urlencoded) of the contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetExtendedContactDetails
     */
    public function getContactInfo($email)
    {
        list($response) = $this->getContactInfoWithHttpInfo($email);
        return $response;
    }

    /**
     * Operation getContactInfoWithHttpInfo
     *
     * Retrieves contact informations
     *
     * @param string $email Email (urlencoded) of the contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetExtendedContactDetails, HTTP status code, HTTP response headers (array of strings)
     */
    public function getContactInfoWithHttpInfo($email)
    {
        // verify the required parameter 'email' is set
        if ($email === null) {
            throw new \InvalidArgumentException('Missing the required parameter $email when calling getContactInfo');
        }
        // parse inputs
        $resourcePath = "/contacts/{email}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($email !== null) {
            $resourcePath = str_replace(
                "{" . "email" . "}",
                $this->apiClient->getSerializer()->toPathValue($email),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetExtendedContactDetails',
                '/contacts/{email}'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetExtendedContactDetails', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetExtendedContactDetails', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getContactStats
     *
     * Get the campaigns statistics for a contact
     *
     * @param string $email Email address (urlencoded) of the contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetContactCampaignStats
     */
    public function getContactStats($email)
    {
        list($response) = $this->getContactStatsWithHttpInfo($email);
        return $response;
    }

    /**
     * Operation getContactStatsWithHttpInfo
     *
     * Get the campaigns statistics for a contact
     *
     * @param string $email Email address (urlencoded) of the contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetContactCampaignStats, HTTP status code, HTTP response headers (array of strings)
     */
    public function getContactStatsWithHttpInfo($email)
    {
        // verify the required parameter 'email' is set
        if ($email === null) {
            throw new \InvalidArgumentException('Missing the required parameter $email when calling getContactStats');
        }
        // parse inputs
        $resourcePath = "/contacts/{email}/campaignStats";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($email !== null) {
            $resourcePath = str_replace(
                "{" . "email" . "}",
                $this->apiClient->getSerializer()->toPathValue($email),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetContactCampaignStats',
                '/contacts/{email}/campaignStats'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetContactCampaignStats', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetContactCampaignStats', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getContacts
     *
     * Get all the contacts
     *
     * @param int $limit Number of documents per page (optional, default to 50)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetContacts
     */
    public function getContacts($limit = '50', $offset = '0')
    {
        list($response) = $this->getContactsWithHttpInfo($limit, $offset);
        return $response;
    }

    /**
     * Operation getContactsWithHttpInfo
     *
     * Get all the contacts
     *
     * @param int $limit Number of documents per page (optional, default to 50)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings)
     */
    public function getContactsWithHttpInfo($limit = '50', $offset = '0')
    {
        if (!is_null($limit) && ($limit > 1000)) {
            throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContacts, must be smaller than or equal to 1000.');
        }

        // parse inputs
        $resourcePath = "/contacts";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // query params
        if ($limit !== null) {
            $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit);
        }
        // query params
        if ($offset !== null) {
            $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset);
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetContacts',
                '/contacts'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetContacts', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetContacts', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getContactsFromList
     *
     * Get the contacts in a list
     *
     * @param int $listId Id of the list (required)
     * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) (optional)
     * @param int $limit Number of documents per page (optional, default to 50)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetContacts
     */
    public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0')
    {
        list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset);
        return $response;
    }

    /**
     * Operation getContactsFromListWithHttpInfo
     *
     * Get the contacts in a list
     *
     * @param int $listId Id of the list (required)
     * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) (optional)
     * @param int $limit Number of documents per page (optional, default to 50)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings)
     */
    public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0')
    {
        // verify the required parameter 'listId' is set
        if ($listId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $listId when calling getContactsFromList');
        }
        if (!is_null($limit) && ($limit > 500)) {
            throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContactsFromList, must be smaller than or equal to 500.');
        }

        // parse inputs
        $resourcePath = "/contacts/lists/{listId}/contacts";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // query params
        if ($modifiedSince !== null) {
            $queryParams['modifiedSince'] = $this->apiClient->getSerializer()->toQueryValue($modifiedSince);
        }
        // query params
        if ($limit !== null) {
            $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit);
        }
        // query params
        if ($offset !== null) {
            $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset);
        }
        // path params
        if ($listId !== null) {
            $resourcePath = str_replace(
                "{" . "listId" . "}",
                $this->apiClient->getSerializer()->toPathValue($listId),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetContacts',
                '/contacts/lists/{listId}/contacts'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetContacts', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetContacts', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getFolder
     *
     * Returns folder details
     *
     * @param int $folderId id of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetFolder
     */
    public function getFolder($folderId)
    {
        list($response) = $this->getFolderWithHttpInfo($folderId);
        return $response;
    }

    /**
     * Operation getFolderWithHttpInfo
     *
     * Returns folder details
     *
     * @param int $folderId id of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings)
     */
    public function getFolderWithHttpInfo($folderId)
    {
        // verify the required parameter 'folderId' is set
        if ($folderId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $folderId when calling getFolder');
        }
        // parse inputs
        $resourcePath = "/contacts/folders/{folderId}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($folderId !== null) {
            $resourcePath = str_replace(
                "{" . "folderId" . "}",
                $this->apiClient->getSerializer()->toPathValue($folderId),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetFolder',
                '/contacts/folders/{folderId}'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolder', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolder', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getFolderLists
     *
     * Get the lists in a folder
     *
     * @param int $folderId Id of the folder (required)
     * @param int $limit Number of documents per page (optional, default to 10)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetFolderLists
     */
    public function getFolderLists($folderId, $limit = '10', $offset = '0')
    {
        list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset);
        return $response;
    }

    /**
     * Operation getFolderListsWithHttpInfo
     *
     * Get the lists in a folder
     *
     * @param int $folderId Id of the folder (required)
     * @param int $limit Number of documents per page (optional, default to 10)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings)
     */
    public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0')
    {
        // verify the required parameter 'folderId' is set
        if ($folderId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $folderId when calling getFolderLists');
        }
        if (!is_null($limit) && ($limit > 50)) {
            throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolderLists, must be smaller than or equal to 50.');
        }

        // parse inputs
        $resourcePath = "/contacts/folders/{folderId}/lists";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // query params
        if ($limit !== null) {
            $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit);
        }
        // query params
        if ($offset !== null) {
            $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset);
        }
        // path params
        if ($folderId !== null) {
            $resourcePath = str_replace(
                "{" . "folderId" . "}",
                $this->apiClient->getSerializer()->toPathValue($folderId),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetFolderLists',
                '/contacts/folders/{folderId}/lists'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolderLists', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolderLists', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getFolders
     *
     * Get all the folders
     *
     * @param int $limit Number of documents per page (required)
     * @param int $offset Index of the first document of the page (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetFolders
     */
    public function getFolders($limit, $offset)
    {
        list($response) = $this->getFoldersWithHttpInfo($limit, $offset);
        return $response;
    }

    /**
     * Operation getFoldersWithHttpInfo
     *
     * Get all the folders
     *
     * @param int $limit Number of documents per page (required)
     * @param int $offset Index of the first document of the page (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings)
     */
    public function getFoldersWithHttpInfo($limit, $offset)
    {
        // verify the required parameter 'limit' is set
        if ($limit === null) {
            throw new \InvalidArgumentException('Missing the required parameter $limit when calling getFolders');
        }
        if (($limit > 50)) {
            throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolders, must be smaller than or equal to 50.');
        }

        // verify the required parameter 'offset' is set
        if ($offset === null) {
            throw new \InvalidArgumentException('Missing the required parameter $offset when calling getFolders');
        }
        // parse inputs
        $resourcePath = "/contacts/folders";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // query params
        if ($limit !== null) {
            $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit);
        }
        // query params
        if ($offset !== null) {
            $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset);
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetFolders',
                '/contacts/folders'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolders', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolders', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getList
     *
     * Get the details of a list
     *
     * @param int $listId Id of the list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetExtendedList
     */
    public function getList($listId)
    {
        list($response) = $this->getListWithHttpInfo($listId);
        return $response;
    }

    /**
     * Operation getListWithHttpInfo
     *
     * Get the details of a list
     *
     * @param int $listId Id of the list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings)
     */
    public function getListWithHttpInfo($listId)
    {
        // verify the required parameter 'listId' is set
        if ($listId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $listId when calling getList');
        }
        // parse inputs
        $resourcePath = "/contacts/lists/{listId}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($listId !== null) {
            $resourcePath = str_replace(
                "{" . "listId" . "}",
                $this->apiClient->getSerializer()->toPathValue($listId),
                $resourcePath
            );
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetExtendedList',
                '/contacts/lists/{listId}'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetExtendedList', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetExtendedList', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation getLists
     *
     * Get all the lists
     *
     * @param int $limit Number of documents per page (optional, default to 10)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\GetLists
     */
    public function getLists($limit = '10', $offset = '0')
    {
        list($response) = $this->getListsWithHttpInfo($limit, $offset);
        return $response;
    }

    /**
     * Operation getListsWithHttpInfo
     *
     * Get all the lists
     *
     * @param int $limit Number of documents per page (optional, default to 10)
     * @param int $offset Index of the first document of the page (optional, default to 0)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings)
     */
    public function getListsWithHttpInfo($limit = '10', $offset = '0')
    {
        if (!is_null($limit) && ($limit > 50)) {
            throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getLists, must be smaller than or equal to 50.');
        }

        // parse inputs
        $resourcePath = "/contacts/lists";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // query params
        if ($limit !== null) {
            $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit);
        }
        // query params
        if ($offset !== null) {
            $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset);
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'GET',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\GetLists',
                '/contacts/lists'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetLists', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetLists', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation importContacts
     *
     * Import contacts
     *
     * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at &#x60;&#x60;https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns&#x60;&#x60; (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\CreatedProcessId
     */
    public function importContacts($requestContactImport)
    {
        list($response) = $this->importContactsWithHttpInfo($requestContactImport);
        return $response;
    }

    /**
     * Operation importContactsWithHttpInfo
     *
     * Import contacts
     *
     * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at &#x60;&#x60;https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns&#x60;&#x60; (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings)
     */
    public function importContactsWithHttpInfo($requestContactImport)
    {
        // verify the required parameter 'requestContactImport' is set
        if ($requestContactImport === null) {
            throw new \InvalidArgumentException('Missing the required parameter $requestContactImport when calling importContacts');
        }
        // parse inputs
        $resourcePath = "/contacts/import";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // body params
        $_tempBody = null;
        if (isset($requestContactImport)) {
            $_tempBody = $requestContactImport;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\CreatedProcessId',
                '/contacts/import'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreatedProcessId', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 202:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreatedProcessId', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation removeContactToList
     *
     * Remove existing contacts from a list
     *
     * @param int $listId Id of the list (required)
     * @param \SendinBlue\Client\Model\AddRemoveContactToList $contactEmails Emails adresses of the contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\PostContactInfo
     */
    public function removeContactToList($listId, $contactEmails)
    {
        list($response) = $this->removeContactToListWithHttpInfo($listId, $contactEmails);
        return $response;
    }

    /**
     * Operation removeContactToListWithHttpInfo
     *
     * Remove existing contacts from a list
     *
     * @param int $listId Id of the list (required)
     * @param \SendinBlue\Client\Model\AddRemoveContactToList $contactEmails Emails adresses of the contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings)
     */
    public function removeContactToListWithHttpInfo($listId, $contactEmails)
    {
        // verify the required parameter 'listId' is set
        if ($listId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $listId when calling removeContactToList');
        }
        // verify the required parameter 'contactEmails' is set
        if ($contactEmails === null) {
            throw new \InvalidArgumentException('Missing the required parameter $contactEmails when calling removeContactToList');
        }
        // parse inputs
        $resourcePath = "/contacts/lists/{listId}/contacts/remove";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($listId !== null) {
            $resourcePath = str_replace(
                "{" . "listId" . "}",
                $this->apiClient->getSerializer()->toPathValue($listId),
                $resourcePath
            );
        }
        // body params
        $_tempBody = null;
        if (isset($contactEmails)) {
            $_tempBody = $contactEmails;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\PostContactInfo',
                '/contacts/lists/{listId}/contacts/remove'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\PostContactInfo', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 201:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostContactInfo', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation requestContactExport
     *
     * Export contacts
     *
     * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return \SendinBlue\Client\Model\CreatedProcessId
     */
    public function requestContactExport($requestContactExport)
    {
        list($response) = $this->requestContactExportWithHttpInfo($requestContactExport);
        return $response;
    }

    /**
     * Operation requestContactExportWithHttpInfo
     *
     * Export contacts
     *
     * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings)
     */
    public function requestContactExportWithHttpInfo($requestContactExport)
    {
        // verify the required parameter 'requestContactExport' is set
        if ($requestContactExport === null) {
            throw new \InvalidArgumentException('Missing the required parameter $requestContactExport when calling requestContactExport');
        }
        // parse inputs
        $resourcePath = "/contacts/export";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // body params
        $_tempBody = null;
        if (isset($requestContactExport)) {
            $_tempBody = $requestContactExport;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'POST',
                $queryParams,
                $httpBody,
                $headerParams,
                '\SendinBlue\Client\Model\CreatedProcessId',
                '/contacts/export'
            );

            return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreatedProcessId', $httpHeader), $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 202:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreatedProcessId', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation updateContact
     *
     * Updates a contact
     *
     * @param string $email Email (urlencoded) of the contact (required)
     * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return void
     */
    public function updateContact($email, $updateContact)
    {
        list($response) = $this->updateContactWithHttpInfo($email, $updateContact);
        return $response;
    }

    /**
     * Operation updateContactWithHttpInfo
     *
     * Updates a contact
     *
     * @param string $email Email (urlencoded) of the contact (required)
     * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of null, HTTP status code, HTTP response headers (array of strings)
     */
    public function updateContactWithHttpInfo($email, $updateContact)
    {
        // verify the required parameter 'email' is set
        if ($email === null) {
            throw new \InvalidArgumentException('Missing the required parameter $email when calling updateContact');
        }
        // verify the required parameter 'updateContact' is set
        if ($updateContact === null) {
            throw new \InvalidArgumentException('Missing the required parameter $updateContact when calling updateContact');
        }
        // parse inputs
        $resourcePath = "/contacts/{email}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($email !== null) {
            $resourcePath = str_replace(
                "{" . "email" . "}",
                $this->apiClient->getSerializer()->toPathValue($email),
                $resourcePath
            );
        }
        // body params
        $_tempBody = null;
        if (isset($updateContact)) {
            $_tempBody = $updateContact;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'PUT',
                $queryParams,
                $httpBody,
                $headerParams,
                null,
                '/contacts/{email}'
            );

            return [null, $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation updateFolder
     *
     * Update a contact folder
     *
     * @param int $folderId Id of the folder (required)
     * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return void
     */
    public function updateFolder($folderId, $updateFolder)
    {
        list($response) = $this->updateFolderWithHttpInfo($folderId, $updateFolder);
        return $response;
    }

    /**
     * Operation updateFolderWithHttpInfo
     *
     * Update a contact folder
     *
     * @param int $folderId Id of the folder (required)
     * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of null, HTTP status code, HTTP response headers (array of strings)
     */
    public function updateFolderWithHttpInfo($folderId, $updateFolder)
    {
        // verify the required parameter 'folderId' is set
        if ($folderId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $folderId when calling updateFolder');
        }
        // verify the required parameter 'updateFolder' is set
        if ($updateFolder === null) {
            throw new \InvalidArgumentException('Missing the required parameter $updateFolder when calling updateFolder');
        }
        // parse inputs
        $resourcePath = "/contacts/folders/{folderId}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($folderId !== null) {
            $resourcePath = str_replace(
                "{" . "folderId" . "}",
                $this->apiClient->getSerializer()->toPathValue($folderId),
                $resourcePath
            );
        }
        // body params
        $_tempBody = null;
        if (isset($updateFolder)) {
            $_tempBody = $updateFolder;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'PUT',
                $queryParams,
                $httpBody,
                $headerParams,
                null,
                '/contacts/folders/{folderId}'
            );

            return [null, $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }

    /**
     * Operation updateList
     *
     * Update a list
     *
     * @param int $listId Id of the list (required)
     * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return void
     */
    public function updateList($listId, $updateList)
    {
        list($response) = $this->updateListWithHttpInfo($listId, $updateList);
        return $response;
    }

    /**
     * Operation updateListWithHttpInfo
     *
     * Update a list
     *
     * @param int $listId Id of the list (required)
     * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
     * @throws \SendinBlue\Client\ApiException on non-2xx response
     * @return array of null, HTTP status code, HTTP response headers (array of strings)
     */
    public function updateListWithHttpInfo($listId, $updateList)
    {
        // verify the required parameter 'listId' is set
        if ($listId === null) {
            throw new \InvalidArgumentException('Missing the required parameter $listId when calling updateList');
        }
        // verify the required parameter 'updateList' is set
        if ($updateList === null) {
            throw new \InvalidArgumentException('Missing the required parameter $updateList when calling updateList');
        }
        // parse inputs
        $resourcePath = "/contacts/lists/{listId}";
        $httpBody = '';
        $queryParams = [];
        $headerParams = [];
        $formParams = [];
        $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
        if (!is_null($_header_accept)) {
            $headerParams['Accept'] = $_header_accept;
        }
        $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

        // path params
        if ($listId !== null) {
            $resourcePath = str_replace(
                "{" . "listId" . "}",
                $this->apiClient->getSerializer()->toPathValue($listId),
                $resourcePath
            );
        }
        // body params
        $_tempBody = null;
        if (isset($updateList)) {
            $_tempBody = $updateList;
        }

        // for model (json/xml)
        if (isset($_tempBody)) {
            $httpBody = $_tempBody; // $_tempBody is the method argument, if present
        } elseif (count($formParams) > 0) {
            $httpBody = $formParams; // for HTTP post (form)
        }
        // this endpoint requires API key authentication
        $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
        if (strlen($apiKey) !== 0) {
            $headerParams['api-key'] = $apiKey;
        }
        // make the API Call
        try {
            list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
                $resourcePath,
                'PUT',
                $queryParams,
                $httpBody,
                $headerParams,
                null,
                '/contacts/lists/{listId}'
            );

            return [null, $statusCode, $httpHeader];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 400:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
                case 404:
                    $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
                    $e->setResponseObject($data);
                    break;
            }

            throw $e;
        }
    }
}
