Skip to content

Commit 80d827a

Browse files
authored
feat(compat): GRPC Server compatible with 0.3 client (#772)
# Description Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [X] Follow the [`CONTRIBUTING` Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md). - [X] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch. - `feat:` represents a new feature, and correlates to a SemVer minor. - `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major. - [X] Ensure the tests and linter pass (Run `bash scripts/format.sh` from the repository root to format) - [X] Appropriate docs were updated (if necessary)
1 parent 3146189 commit 80d827a

12 files changed

Lines changed: 2158 additions & 8 deletions

File tree

.github/actions/spelling/allow.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,4 @@ tiangolo
129129
typ
130130
typeerror
131131
vulnz
132+
TResponse

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ coverage.xml
1212
spec.json
1313
src/a2a/types/a2a.json
1414
docker-compose.yaml
15+
.geminiignore

src/a2a/compat/v0_3/conversions.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,13 @@ def to_core_get_task_push_notification_config_request(
11231123
compat_req: types_v03.GetTaskPushNotificationConfigRequest,
11241124
) -> pb2_v10.GetTaskPushNotificationConfigRequest:
11251125
"""Convert get task push notification config request to v1.0 core type."""
1126+
if isinstance(
1127+
compat_req.params, types_v03.GetTaskPushNotificationConfigParams
1128+
):
1129+
return pb2_v10.GetTaskPushNotificationConfigRequest(
1130+
task_id=compat_req.params.id,
1131+
id=compat_req.params.push_notification_config_id,
1132+
)
11261133
return pb2_v10.GetTaskPushNotificationConfigRequest(
11271134
task_id=compat_req.params.id
11281135
)
@@ -1133,8 +1140,17 @@ def to_compat_get_task_push_notification_config_request(
11331140
request_id: str | int,
11341141
) -> types_v03.GetTaskPushNotificationConfigRequest:
11351142
"""Convert get task push notification config request to v0.3 compat type."""
1143+
params: (
1144+
types_v03.GetTaskPushNotificationConfigParams | types_v03.TaskIdParams
1145+
)
1146+
if core_req.id:
1147+
params = types_v03.GetTaskPushNotificationConfigParams(
1148+
id=core_req.task_id, push_notification_config_id=core_req.id
1149+
)
1150+
else:
1151+
params = types_v03.TaskIdParams(id=core_req.task_id)
11361152
return types_v03.GetTaskPushNotificationConfigRequest(
1137-
id=request_id, params=types_v03.TaskIdParams(id=core_req.task_id)
1153+
id=request_id, params=params
11381154
)
11391155

11401156

0 commit comments

Comments
 (0)