Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit d002b39

Browse files
committed
feat: add support for reading google.api.api_version
1 parent e403acc commit d002b39

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

gapic/schema/wrappers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,17 @@ def host(self) -> str:
17341734
return self.options.Extensions[client_pb2.default_host]
17351735
return ''
17361736

1737+
@property
1738+
def api_version(self) -> str:
1739+
"""Return the API version for this service, if specified.
1740+
1741+
Returns:
1742+
str: The API version for this service.
1743+
"""
1744+
if self.options.Extensions[client_pb2.api_version]:
1745+
return self.options.Extensions[client_pb2.api_version]
1746+
return ''
1747+
17371748
@property
17381749
def shortname(self) -> str:
17391750
"""Return the API short name. DRIFT uses this to identify

gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ class {{ service.client_name }}Meta(type):
102102

103103

104104
class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
105-
"""{{ service.meta.doc|rst(width=72, indent=4) }}"""
105+
"""{{ service.meta.doc|rst(width=72, indent=4) }}
106+
{% if service.api_version|length %}
107+
This class implements API version {{ service.api_version }}.
108+
{% endif %}
109+
"""
106110

107111
@staticmethod
108112
def _get_default_mtls_endpoint(api_endpoint):

0 commit comments

Comments
 (0)