<?php

if(!function_exists('dhwp_mailchimp_get_api')){
    /**
     * @param string $api_key
     * @return DHWP_Mailchimp_API_V3
     */
    function dhwp_mailchimp_get_api($api_key) {
        if(!class_exists('DHWP_Mailchimp_API_V3',false)){
            require_once __DIR__.'/class-dh-mailchimp-api-v3.php';
            require_once __DIR__.'/class-dh-mailchimp-api-v3-client.php';
            require_once __DIR__.'/class-dh-mailchimp-api-exception.php';
            require_once __DIR__.'/class-dh-mailchimp-api-connection-exception.php';
            require_once __DIR__.'/class-dh-mailchimp-api-resource-not-found-exception.php';
        }
        $api = new DHWP_Mailchimp_API_V3($api_key);
        return $api;
    }
}