Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8ea95e9
chore: unpin mypy check version
daniel-sanche Jan 20, 2026
e42c823
updated goldens
daniel-sanche Jan 20, 2026
7847002
handle empty requests in mixins
daniel-sanche Jan 20, 2026
e476732
allow dict as request type
daniel-sanche Jan 20, 2026
3cb8e92
handle none case in _get_default_mtls_endpoint
daniel-sanche Jan 20, 2026
7680213
add check_untyped_defs
daniel-sanche Jan 20, 2026
b8e99f4
fixed binary dump format
daniel-sanche Jan 20, 2026
75748ee
fixed inconsistent typing in api_endpoint
daniel-sanche Jan 21, 2026
0118aaf
fixed typo
daniel-sanche Jan 21, 2026
fb5f0cb
updated tests
daniel-sanche Jan 21, 2026
7189985
fixed missing bracket
daniel-sanche Jan 21, 2026
ffd53ad
updated mypy in other noxfiles
daniel-sanche Jan 21, 2026
4e8a7a6
added changes to ads-templates
daniel-sanche Jan 21, 2026
6664f75
updated ads template tests
daniel-sanche Jan 21, 2026
f394d57
updated async mixins
daniel-sanche Jan 21, 2026
7b7c8dc
updated iam templates
daniel-sanche Jan 21, 2026
96f14a3
updated async iam methods
daniel-sanche Jan 21, 2026
7264e63
updated iam methods in ads-template
daniel-sanche Jan 21, 2026
cbe19db
updated some goldens
daniel-sanche Jan 21, 2026
3920092
improved typing
daniel-sanche Jan 21, 2026
681e626
updated more goldens
daniel-sanche Jan 21, 2026
10007c2
updated api_endpoint type
daniel-sanche Jan 21, 2026
1a3afcd
set api_endpoint to empty string
daniel-sanche Jan 21, 2026
51b2253
updated goldens
daniel-sanche Jan 21, 2026
b50adfc
updated wrapped methods type
daniel-sanche Jan 21, 2026
c98f2f0
updated goldens
daniel-sanche Jan 21, 2026
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 @@ -3,7 +3,7 @@
{% if "ListOperations" in api.mixin_api_methods %}
def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand All @@ -27,8 +27,12 @@
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.ListOperationsRequest(**request)
if request is None:
request_pb = operations_pb2.ListOperationsRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.ListOperationsRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -38,12 +42,12 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("name", request.name),)),
(("name", request_pb.name),)),
)

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand All @@ -53,7 +57,7 @@
{% if "GetOperation" in api.mixin_api_methods %}
def get_operation(
self,
request: Optional[operations_pb2.GetOperationRequest] = None,
request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand All @@ -77,8 +81,12 @@
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.GetOperationRequest(**request)
if request is None:
request_pb = operations_pb2.GetOperationRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.GetOperationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -88,12 +96,12 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("name", request.name),)),
(("name", request_pb.name),)),
)

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand All @@ -102,7 +110,7 @@
{% if "DeleteOperation" in api.mixin_api_methods %}
def delete_operation(
self,
request: Optional[operations_pb2.DeleteOperationRequest] = None,
request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -130,8 +138,12 @@
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.DeleteOperationRequest(**request)
if request is None:
request_pb = operations_pb2.DeleteOperationRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.DeleteOperationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -141,17 +153,17 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("name", request.name),)),
(("name", request_pb.name),)),
)

# Send the request.
rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
rpc(request_pb, retry=retry, timeout=timeout, metadata=metadata,)
{% endif %}

{% if "CancelOperation" in api.mixin_api_methods %}
def cancel_operation(
self,
request: Optional[operations_pb2.CancelOperationRequest] = None,
request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand All @@ -178,8 +190,12 @@
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.CancelOperationRequest(**request)
if request is None:
request_pb = operations_pb2.CancelOperationRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.CancelOperationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -189,17 +205,17 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("name", request.name),)),
(("name", request_pb.name),)),
)

# Send the request.
rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
rpc(request_pb, retry=retry, timeout=timeout, metadata=metadata,)
{% endif %}

{% if "WaitOperation" in api.mixin_api_methods %}
def wait_operation(
self,
request: Optional[operations_pb2.WaitOperationRequest] = None,
request: Optional[Union[operations_pb2.WaitOperationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -229,8 +245,12 @@
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.WaitOperationRequest(**request)
if request is None:
request_pb = operations_pb2.WaitOperationRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.WaitOperationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -240,7 +260,7 @@

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand All @@ -254,7 +274,7 @@
{% if "SetIamPolicy" in api.mixin_api_methods %}
def set_iam_policy(
self,
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -344,8 +364,12 @@

# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = iam_policy_pb2.SetIamPolicyRequest(**request)
if request is None:
request_pb = iam_policy_pb2.SetIamPolicyRequest()
elif isinstance(request, dict):
request_pb = iam_policy_pb2.SetIamPolicyRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -355,12 +379,12 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("resource", request.resource),)),
(("resource", request_pb.resource),)),
)

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand All @@ -369,7 +393,7 @@
{% if "GetIamPolicy" in api.mixin_api_methods %}
def get_iam_policy(
self,
request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -460,8 +484,12 @@

# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = iam_policy_pb2.GetIamPolicyRequest(**request)
if request is None:
request_pb = iam_policy_pb2.GetIamPolicyRequest()
elif isinstance(request, dict):
request_pb = iam_policy_pb2.GetIamPolicyRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -471,12 +499,12 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("resource", request.resource),)),
(("resource", request_pb.resource),)),
)

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand All @@ -485,7 +513,7 @@
{% if "TestIamPermissions" in api.mixin_api_methods %}
def test_iam_permissions(
self,
request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -514,8 +542,12 @@

# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = iam_policy_pb2.TestIamPermissionsRequest(**request)
if request is None:
request_pb = iam_policy_pb2.TestIamPermissionsRequest()
elif isinstance(request, dict):
request_pb = iam_policy_pb2.TestIamPermissionsRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -525,12 +557,12 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("resource", request.resource),)),
(("resource", request_pb.resource),)),
)

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand All @@ -543,7 +575,7 @@
{% if "GetLocation" in api.mixin_api_methods %}
def get_location(
self,
request: Optional[locations_pb2.GetLocationRequest] = None,
request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand All @@ -567,8 +599,12 @@
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.GetLocationRequest(**request)
if request is None:
request_pb = locations_pb2.GetLocationRequest()
elif isinstance(request, dict):
request_pb = locations_pb2.GetLocationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -578,12 +614,12 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("name", request.name),)),
(("name", request_pb.name),)),
)

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand All @@ -592,7 +628,7 @@
{% if "ListLocations" in api.mixin_api_methods %}
def list_locations(
self,
request: Optional[locations_pb2.ListLocationsRequest] = None,
request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand All @@ -616,8 +652,12 @@
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.ListLocationsRequest(**request)
if request is None:
request_pb = locations_pb2.ListLocationsRequest()
elif isinstance(request, dict):
request_pb = locations_pb2.ListLocationsRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -627,12 +667,12 @@
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("name", request.name),)),
(("name", request_pb.name),)),
)

# Send the request.
response = rpc(
request, retry=retry, timeout=timeout, metadata=metadata,)
request_pb, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response
Expand Down
Loading
Loading