. namespace core; use Google\Client; /** * Google API Client integration for Moodle. * * @package core * @copyright 2025 Huong Nguyen * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class google_api_client extends Client{ /** * Constructor. * * @param array $config Configuration array. */ public function __construct(array $config = []) { $client = di::get(http_client::class); $this->setHttpClient($client); $config = $this->get_options($config); parent::__construct($config); } /** * Get the custom options for Google API Client integration in Moodle. * * @param array $settings The settings or options from client. * @return array */ protected function get_options(array $settings): array { global $CFG; if (empty($settings['application_name'])) { // Configure the application name. $settings['application_name'] = 'Moodle ' . $CFG->release; } if (empty($settings['access_type'])) { // Configure the access type. $settings['access_type'] = 'online'; } if (empty($settings['approval_prompt'])) { // Configure the approval prompt. $settings['approval_prompt'] = 'auto'; } return $settings; } }