
class MAS_Google_Client_Wrapper {
    private $client;

    public function __construct($user_id = null) {
        if (!$user_id) {
            $user_id = get_current_user_id();
        }

        $client_id     = get_user_meta($user_id, 'mas_gmeet_client_id', true);
        $client_secret = get_user_meta($user_id, 'mas_gmeet_client_secret', true);
        $tokens        = get_user_meta($user_id, 'mas_gmeet_tokens', true);
        $redirect_uri  = admin_url('admin.php?page=mas-gmeet-callback');

        if (!$client_id || !$client_secret) {
            throw new Exception(__('Google Client ID/Secret not set. Please configure in your Instructor Dashboard → Google Meet Settings.', 'meeting-attendance'));
        }

        $this->client = new Google_Client();
        $this->client->setClientId($client_id);
        $this->client->setClientSecret($client_secret);
        $this->client->setRedirectUri($redirect_uri);
        $this->client->addScope(Google_Service_Calendar::CALENDAR);

        if (!$tokens) {
            throw new Exception(__('Google account not connected. Please connect from your Google Meet Settings tab.', 'meeting-attendance'));
        }

        $this->client->setAccessToken($tokens);

        if ($this->client->isAccessTokenExpired() && $this->client->getRefreshToken()) {
            $new_token = $this->client->fetchAccessTokenWithRefreshToken($this->client->getRefreshToken());
            update_user_meta($user_id, 'mas_gmeet_tokens', $new_token);
            $this->client->setAccessToken($new_token);
        }
    }

    public function get_client() {
        return $this->client;
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://test.sangeetkasparsh.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://test.sangeetkasparsh.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://test.sangeetkasparsh.com/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://test.sangeetkasparsh.com/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://test.sangeetkasparsh.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
