GSpace Client
The main client class for accessing Google Workspace services.
Class Definition
pythonclass GSpace: def __init__( self, credentials: str | Path, auth_type: str = "OAuth2", scopes: list[str] | None = None, )
Factory Methods
from_oauth
Create a GSpace client using OAuth2 authentication.
python@classmethod def from_oauth( cls, credentials_file: str | Path, scopes: list[str] ) -> GSpace
Parameters:
credentials_file: Path to OAuth2 client credentials JSON filescopes: List of Google API scopes
Returns: GSpace client instance
Example:
pythongspace = GSpace.from_oauth( credentials_file="credentials.json", scopes=["calendar", "gmail"] )
from_service_account
Create a GSpace client using Service Account authentication.
python@classmethod def from_service_account( cls, service_account_file: str | Path, scopes: list[str] ) -> GSpace
Service Methods
calendar()
Get the Calendar service instance.
pythoncalendar = gspace.calendar()
gmail()
Get the Gmail service instance.
pythongmail = gspace.gmail()
drive()
Get the Drive service instance.
pythondrive = gspace.drive()
sheets()
Get the Sheets service instance.
pythonsheets = gspace.sheets()
docs()
Get the Docs service instance.
pythondocs = gspace.docs()
Other Methods
close()
Close the client and clean up resources.
pythongspace.close()