To start the Gmail OAuth connection process, use initiate_connect. This function requires a GmailConnectPayload containing the user_id and an auth_config_id. If auth_config_id is not provided in the payload, it will attempt to use the composio_gmail_auth_config_id from the application settings.
It returns a JSONResponse containing a redirect_url for the user to complete authentication, a connection_request_id, and the user_id.
# Example usage (conceptual)
from server.services.gmail.client import initiate_connect
from server.models import GmailConnectPayload
payload = GmailConnectPayload(
user_id="user_123",
auth_config_id="your_composio_auth_config_id"
)
response = initiate_connect(payload, settings)
# response contains {'ok': True, 'redirect_url': '...', 'connection_request_id': '...', 'user_id': 'user_123'}