Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ replacements:
drive/types_
gmail/services_
gmail/types_
meet/services_
meet/types_
sheets/services_
sheets/types_
slides/services_
Expand Down
6 changes: 6 additions & 0 deletions librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,13 @@ libraries:
- path: google/apps/script/type/sheets
- path: google/apps/script/type/calendar
- path: google/apps/script/type/slides
- path: google/apps/script/type/meet
keep:
- tests/unit/gapic/calendar/test_calendar.py
- tests/unit/gapic/docs/test_docs.py
- tests/unit/gapic/drive/test_drive.py
- tests/unit/gapic/gmail/test_gmail.py
- tests/unit/gapic/meet/test_meet.py
- tests/unit/gapic/sheets/test_sheets.py
- tests/unit/gapic/slides/test_slides.py
- tests/unit/gapic/type/test_type.py
Expand All @@ -227,6 +229,10 @@ libraries:
- proto-plus-deps=google.apps.script.type
- python-gapic-namespace=google.apps.script.type
- python-gapic-name=gmail
google/apps/script/type/meet:
- proto-plus-deps=google.apps.script.type
- python-gapic-namespace=google.apps.script.type
- python-gapic-name=meet
google/apps/script/type/sheets:
- proto-plus-deps=google.apps.script.type
- python-gapic-namespace=google.apps.script.type
Expand Down
2 changes: 2 additions & 0 deletions packages/google-apps-script-type/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ API Reference
drive/types_
gmail/services_
gmail/types_
meet/services_
meet/types_
sheets/services_
sheets/types_
slides/services_
Expand Down
4 changes: 4 additions & 0 deletions packages/google-apps-script-type/docs/meet/services_.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Services for Google Apps Script Type Meet API
==============================================
.. toctree::
:maxdepth: 2
6 changes: 6 additions & 0 deletions packages/google-apps-script-type/docs/meet/types_.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Types for Google Apps Script Type Meet API
===========================================

.. automodule:: google.apps.script.type.meet.types
:members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import google.api_core as api_core

from google.apps.script.type.meet import gapic_version as package_version

__version__ = package_version.__version__

# PEP 0810: Explicit Lazy Imports
# Python 3.15+ natively intercepts and defers these imports.
# Developers can disable this behavior and force eager imports.
# For more information, see:
# https://docs.python.org/3.15/library/sys.html#sys.set_lazy_imports_filter
# Older Python versions safely ignore this variable.
__lazy_modules__ = {
"google.apps.script.type.meet.types.meet_addon_manifest",
}


from .types.meet_addon_manifest import MeetAddOnManifest, Web

__all__ = (
"MeetAddOnManifest",
"Web",
)

api_core.check_python_version("google.apps.script.type.meet")
api_core.check_dependency_versions("google.apps.script.type.meet")
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""A compatibility module for older versions of google-api-core."""

import json
import os
from typing import Any, Dict, List, Optional, Tuple
from urllib.parse import urlparse, urlunparse

from google.api_core import path_template
from google.api_core.universe import EmptyUniverseError
from google.auth.exceptions import MutualTLSChannelError
from google.protobuf import json_format

try:
# note: `#type: ignore` is added because the return type for `should_use_client_cert`
# is different than that of the fallback implementation below. This will be removed once
# we bump the minimum supported version of google-auth.
from google.auth.transport.mtls import should_use_client_cert # type: ignore
except ImportError: # pragma: NO COVER

def should_use_client_cert():
"""Returns whether client certificate should be used for mTLS."""
use_client_cert = os.getenv(
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
).lower()
if use_client_cert not in ("true", "false"):
raise ValueError(
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
" either `true` or `false`"
)
return use_client_cert == "true"


def read_environment_variables():
"""Returns the environment variables used by the client.

Returns:
Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.

Raises:
ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
any of ["true", "false"].
google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
is not any of ["auto", "never", "always"].
"""
use_client_cert = should_use_client_cert()
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
if use_mtls_endpoint not in ("auto", "never", "always"):
raise MutualTLSChannelError(
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`,"
" `auto` or `always`"
)
return use_client_cert, use_mtls_endpoint, universe_domain_env


DEFAULT_UNIVERSE = "googleapis.com"

try:
from google.api_core.universe import get_default_mtls_endpoint
except ImportError: # pragma: NO COVER

def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
"""Converts api endpoint to mTLS endpoint.

Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
"*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
Other URLs (including those that do not match these domain suffixes or
already contain '.mtls.') are passed through as-is.

Args:
api_endpoint (Optional[str]): the api endpoint to convert.

Returns:
Optional[str]: converted mTLS api endpoint.
"""
if not api_endpoint or ".mtls." in api_endpoint.lower():
return api_endpoint

has_scheme = "://" in api_endpoint
if not has_scheme:
parsed = urlparse("//" + api_endpoint)
else:
parsed = urlparse(api_endpoint)

host = parsed.hostname
if not host:
return api_endpoint

port = f":{parsed.port}" if parsed.port else ""

lowered_host = host.lower()
suffix_sandbox = ".sandbox.googleapis.com"
suffix_google = ".googleapis.com"
if lowered_host.endswith(suffix_sandbox):
new_host = host[: -len(suffix_sandbox)] + ".mtls.sandbox.googleapis.com"
elif lowered_host.endswith(suffix_google):
new_host = host[: -len(suffix_google)] + ".mtls.googleapis.com"
else:
return api_endpoint

netloc = new_host + port
new_parsed = parsed._replace(netloc=netloc)

if not has_scheme:
return urlunparse(new_parsed)[2:]
else:
return urlunparse(new_parsed)


try:
from google.api_core.universe import get_api_endpoint
except ImportError: # pragma: NO COVER

def get_api_endpoint(
api_override: Optional[str],
universe_domain: str,
default_universe: str,
default_mtls_endpoint: Optional[str],
default_endpoint_template: str,
use_mtls: bool,
) -> str:
"""Return the API endpoint used by the client.

Args:
api_override (Optional[str]): The API endpoint override. If specified,
this is always returned.
universe_domain (str): The universe domain used by the client.
default_universe (str): The default universe domain.
default_mtls_endpoint (Optional[str]): The default mTLS endpoint.
default_endpoint_template (str): The default endpoint template containing
a placeholder `{UNIVERSE_DOMAIN}`.
use_mtls (bool): Whether to use the mTLS endpoint.

Returns:
str: The API endpoint to be used by the client.

Raises:
google.auth.exceptions.MutualTLSChannelError: If mTLS is requested but
not supported in the configured universe domain.
ValueError: If mTLS is requested but no mTLS endpoint is available.
"""
if api_override is not None:
return api_override

if use_mtls:
if universe_domain.lower() != default_universe.lower():
raise MutualTLSChannelError(
f"mTLS is not supported in any universe other than {default_universe}."
)
if not default_mtls_endpoint:
raise ValueError("mTLS endpoint is not available.")
return default_mtls_endpoint
else:
return default_endpoint_template.format(UNIVERSE_DOMAIN=universe_domain)


try:
from google.api_core.universe import get_universe_domain
except ImportError: # pragma: NO COVER

def get_universe_domain(
*potential_universes: Optional[str],
default_universe: str,
) -> str:
"""Return the universe domain used by the client.

Args:
*potential_universes (Optional[str]): Potential universe domains in order of preference.
default_universe (str): The default universe domain.

Returns:
str: The universe domain to be used by the client.

Raises:
EmptyUniverseError: If the resolved universe domain is an empty string.
"""
resolved = next(
(x.strip() for x in potential_universes if x is not None),
default_universe,
)

if not resolved:
raise EmptyUniverseError()
return resolved


try:
from google.api_core.rest_helpers import transcode_request # type: ignore
except ImportError: # pragma: NO COVER

def transcode_request(
http_options: List[Dict[str, str]],
request: Any,
required_fields_default_values: Optional[Dict[str, Any]] = None,
rest_numeric_enums: bool = False,
) -> Tuple[Dict[str, Any], Optional[str], Dict[str, Any]]:
"""Transcodes a request into HTTP method, URI, body, and query parameters.

Args:
http_options (List[Dict[str, str]]): List of HTTP transcoding rules.
request (Any): The protobuf or proto-plus request message.
required_fields_default_values (Optional[Dict[str, Any]]): Dictionary
of required fields default values to merge into query parameters if missing.
rest_numeric_enums (bool): Whether to encode enums as integers.

Returns:
Tuple[Dict[str, Any], Optional[str], Dict[str, Any]]: A tuple containing:
- The raw transcoded request dictionary (containing keys like 'uri', 'method').
- The serialized request body JSON string, or None if no body.
- The query parameters dictionary.
"""
if request is None:
raise TypeError("request cannot be None")

# Convert proto-plus message to its underlying protobuf message if needed
pb_request = getattr(request, "_pb", request)

transcoded_request = path_template.transcode(http_options, pb_request)

body_json = None
if transcoded_request.get("body") is not None:
body_json = json_format.MessageToJson(
transcoded_request["body"],
use_integers_for_enums=rest_numeric_enums,
)

query_params_json = {}
if transcoded_request.get("query_params") is not None:
query_params_json = json.loads(
json_format.MessageToJson(
transcoded_request["query_params"],
use_integers_for_enums=rest_numeric_enums,
)
)

# If required_fields_default_values is provided, we merge default values for missing
# required fields into the query parameters.
if required_fields_default_values:
for k, v in required_fields_default_values.items():
if k not in query_params_json:
query_params_json[k] = v

if rest_numeric_enums:
query_params_json["$alt"] = "json;enum-encoding=int"

return transcoded_request, body_json, query_params_json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.apps.script.type.meet",
"protoPackage": "google.apps.script.type.meet",
"schema": "1.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.8.1" # {x-release-please-version}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Marker file for PEP 561.
# The google-apps-script-type package uses inline types.
Loading
Loading