@@ -1499,6 +1499,7 @@ class Method:
14991499 meta : metadata .Metadata = dataclasses .field (
15001500 default_factory = metadata .Metadata ,
15011501 )
1502+ resumable_upload_prefix : str = "resumable/upload"
15021503
15031504 def __getattr__ (self , name ):
15041505 return getattr (self .method_pb , name )
@@ -1728,6 +1729,13 @@ def http_opt(self) -> Optional[Dict[str, str]]:
17281729 # TODO(yon-mg): enums for http verbs?
17291730 return answer
17301731
1732+ @property
1733+ def is_resumable_upload (self ) -> bool :
1734+ """Return True if this method is a resumable upload method."""
1735+ # Resumable upload method names are temporarily hardcoded here until
1736+ # the resumable upload proto annotation exists and is published.
1737+ return self .name in ("UploadMedia" , "CreateYouTubeVideoUpload" )
1738+
17311739 @property
17321740 def path_params (self ) -> Sequence [str ]:
17331741 """Return the path parameters found in the http annotation path template"""
@@ -2208,6 +2216,16 @@ def has_pagers(self) -> bool:
22082216 """Return whether the service has paged methods."""
22092217 return any (m .paged_result_field for m in self .methods .values ())
22102218
2219+ @property
2220+ def has_resumable_upload_methods (self ) -> bool :
2221+ """Return whether this specific service has resumable upload methods.
2222+
2223+ Used during per-service file generation and in service-level templates
2224+ to conditionally emit resumable upload imports, transports, and client
2225+ methods only for services that define resumable upload RPCs.
2226+ """
2227+ return any (m .is_resumable_upload for m in self .methods .values ())
2228+
22112229 @property
22122230 def host (self ) -> str :
22132231 """Return the hostname for this service, if specified.
0 commit comments