@@ -271,9 +271,9 @@ def to_compat_authentication_info(
271271
272272def to_core_push_notification_config (
273273 compat_config : types_v03 .PushNotificationConfig ,
274- ) -> pb2_v10 .PushNotificationConfig :
274+ ) -> pb2_v10 .TaskPushNotificationConfig :
275275 """Convert push notification config to v1.0 core type."""
276- core_config = pb2_v10 .PushNotificationConfig (url = compat_config .url )
276+ core_config = pb2_v10 .TaskPushNotificationConfig (url = compat_config .url )
277277 if compat_config .id :
278278 core_config .id = compat_config .id
279279 if compat_config .token :
@@ -286,11 +286,11 @@ def to_core_push_notification_config(
286286
287287
288288def to_compat_push_notification_config (
289- core_config : pb2_v10 .PushNotificationConfig ,
289+ core_config : pb2_v10 .TaskPushNotificationConfig ,
290290) -> types_v03 .PushNotificationConfig :
291291 """Convert push notification config to v0.3 compat type."""
292292 return types_v03 .PushNotificationConfig (
293- url = core_config .url ,
293+ url = core_config .url if core_config . url else '' ,
294294 id = core_config .id if core_config .id else None ,
295295 token = core_config .token if core_config .token else None ,
296296 authentication = to_compat_authentication_info (core_config .authentication )
@@ -312,7 +312,7 @@ def to_core_send_message_configuration(
312312 compat_config .accepted_output_modes
313313 )
314314 if compat_config .push_notification_config :
315- core_config .push_notification_config .CopyFrom (
315+ core_config .task_push_notification_config .CopyFrom (
316316 to_core_push_notification_config (
317317 compat_config .push_notification_config
318318 )
@@ -333,9 +333,9 @@ def to_compat_send_message_configuration(
333333 if core_config .accepted_output_modes
334334 else None ,
335335 push_notification_config = to_compat_push_notification_config (
336- core_config .push_notification_config
336+ core_config .task_push_notification_config
337337 )
338- if core_config .HasField ('push_notification_config ' )
338+ if core_config .HasField ('task_push_notification_config ' )
339339 else None ,
340340 history_length = core_config .history_length
341341 if core_config .HasField ('history_length' )
@@ -1008,7 +1008,7 @@ def to_core_task_push_notification_config(
10081008 task_id = compat_config .task_id
10091009 )
10101010 if compat_config .push_notification_config :
1011- core_config .push_notification_config . CopyFrom (
1011+ core_config .MergeFrom (
10121012 to_core_push_notification_config (
10131013 compat_config .push_notification_config
10141014 )
@@ -1022,10 +1022,8 @@ def to_compat_task_push_notification_config(
10221022 """Convert task push notification config to v0.3 compat type."""
10231023 return types_v03 .TaskPushNotificationConfig (
10241024 task_id = core_config .task_id ,
1025- push_notification_config = to_compat_push_notification_config (
1026- core_config .push_notification_config
1027- )
1028- if core_config .HasField ('push_notification_config' )
1025+ push_notification_config = to_compat_push_notification_config (core_config )
1026+ if core_config .url
10291027 else types_v03 .PushNotificationConfig (url = '' ),
10301028 )
10311029
@@ -1179,13 +1177,13 @@ def to_compat_delete_task_push_notification_config_request(
11791177
11801178def to_core_create_task_push_notification_config_request (
11811179 compat_req : types_v03 .SetTaskPushNotificationConfigRequest ,
1182- ) -> pb2_v10 .CreateTaskPushNotificationConfigRequest :
1180+ ) -> pb2_v10 .TaskPushNotificationConfig :
11831181 """Convert create task push notification config request to v1.0 core type."""
1184- core_req = pb2_v10 .CreateTaskPushNotificationConfigRequest (
1182+ core_req = pb2_v10 .TaskPushNotificationConfig (
11851183 task_id = compat_req .params .task_id
11861184 )
11871185 if compat_req .params .push_notification_config :
1188- core_req .config . CopyFrom (
1186+ core_req .MergeFrom (
11891187 to_core_push_notification_config (
11901188 compat_req .params .push_notification_config
11911189 )
@@ -1194,7 +1192,7 @@ def to_core_create_task_push_notification_config_request(
11941192
11951193
11961194def to_compat_create_task_push_notification_config_request (
1197- core_req : pb2_v10 .CreateTaskPushNotificationConfigRequest ,
1195+ core_req : pb2_v10 .TaskPushNotificationConfig ,
11981196 request_id : str | int ,
11991197) -> types_v03 .SetTaskPushNotificationConfigRequest :
12001198 """Convert create task push notification config request to v0.3 compat type."""
@@ -1203,9 +1201,9 @@ def to_compat_create_task_push_notification_config_request(
12031201 params = types_v03 .TaskPushNotificationConfig (
12041202 task_id = core_req .task_id ,
12051203 push_notification_config = to_compat_push_notification_config (
1206- core_req . config
1204+ core_req
12071205 )
1208- if core_req .HasField ( 'config' )
1206+ if core_req .url
12091207 else types_v03 .PushNotificationConfig (url = '' ),
12101208 ),
12111209 )
0 commit comments