class_docstr: A class for handling connections and interactions with the Gmail API.
  
  Attributes:
      credentials_file (str): The path to the Google Auth Credentials file for authentication
      and interacting with the Gmail API on behalf of the uesr.
  
      scopes (List[str], Optional): The scopes to use when authenticating with the Gmail API.
class_docstr_tok: ["A","class","for","handling","connections","and","interactions","with","the","Gmail","API",".","Attributes",":","credentials_file","(","str",")",":","The","path","to","the","Google","Auth","Credentials","file","for","authentication","and","interacting","with","the","Gmail","API","on","behalf","of","the","uesr",".","scopes","(","List","[","str","]",",","Optional",")",":","The","scopes","to","use","when","authenticating","with","the","Gmail","API","."]
docstr: Call Gmail API and map the data to pandas DataFrame
  Args:
      method_name (str): method name
      params (dict): query parameters
  Returns:
      DataFrame
docstr_tok: ["Call","Gmail","API","and","map","the","data","to","pandas","DataFrame","Args",":","method_name","(","str",")",":","method","name","params","(","dict",")",":","query","parameters","Returns",":","DataFrame"]
code: def call_gmail_api(
      self, method_name: str = None, params: dict = None
  ) -> pd.DataFrame:
      """Call Gmail API and map the data to pandas DataFrame
      Args:
          method_name (str): method name
          params (dict): query parameters
      Returns:
          DataFrame
      """
      service = self.connect()
      if method_name == "list_messages":
          method = service.users().messages().list
      elif method_name == "send_message":
          method = service.users().messages().send
      elif method_name == "delete_message":
          method = service.users().messages().trash
      elif method_name == "update_message":
          method = service.users().messages().modify
      else:
          raise NotImplementedError(
              f"Unknown method_name: {method_name}"
          )
  
      left = None
      count_results = None
      if "maxResults" in params:
          count_results = params["maxResults"]
  
      params["userId"] = "me"
  
      data = []
      limit_exec_time = time.time() + 60
  
      while True:
          if time.time() > limit_exec_time:
              raise RuntimeError("Handler request timeout error")
  
          if count_results is not None:
              left = count_results - len(data)
              if left == 0:
                  break
              elif left < 0:
                  # got more results that we need
                  data = data[:left]
                  break
  
              if left > self.max_page_size:
                  params["maxResults"] = self.max_page_size
              else:
                  params["maxResults"] = left
  
          logger.debug(
              f"Calling Gmail API: {method_name} with params ({params})"
          )
  
          resp = method(**params).execute()
  
          if "messages" in resp:
              self._handle_list_messages_response(
                  data, resp["messages"]
              )
          elif isinstance(resp, dict):
              data.append(resp)
  
          if count_results is not None and "nextPageToken" in resp:
              params["pageToken"] = resp["nextPageToken"]
          else:
              break
  
      df = pd.DataFrame(data)
  
      return df
  
imports: import json
  from shutil import copyfile
  from collections import OrderedDict
  import requests
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
  from mindsdb.integrations.libs.api_handler import APIHandler, APITable
  from mindsdb_sql.parser import ast
  from mindsdb.utilities import log
  from mindsdb_sql import parse_sql
  from mindsdb.utilities.config import Config
  import os
  import time
  from typing import List
  import pandas
  from google.auth.transport.requests import Request
  from google.oauth2.credentials import Credentials
  from google_auth_oauthlib.flow import Flow
  from googleapiclient.discovery import build
  from googleapiclient.errors import HttpError
  from email.message import EmailMessage
  from base64 import urlsafe_b64encode, urlsafe_b64decode
  from .utils import AuthException, google_auth_flow, save_creds_to_file
label_desc: Use image node_id 12 for calling the GmailHandler obj's underlying member method code with example usage: obj.call_gmail_api(method_name, params) and returns: df