File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 33import collections .abc
44import typing
55
6+ from pydantic import BaseModel , Field
7+
68from a2a .auth .user import UnauthenticatedUser , User
79
810
911State = collections .abc .MutableMapping [str , typing .Any ]
1012
1113
12- class ServerCallContext :
14+ class ServerCallContext ( BaseModel ) :
1315 """A context passed when calling a server method.
1416
1517 This class allows storing arbitrary user data in the state attribute.
1618 """
1719
18- def __init__ (self , state : State | None = None , user : User | None = None ):
19- self ._state = state or {}
20- self ._user = user or UnauthenticatedUser ()
21-
22- @property
23- def user (self ) -> User :
24- """Get the user associated with this context, or UnauthenticatedUser."""
25- return self ._user
26-
27- @property
28- def state (self ) -> State :
29- """Get the user-provided state."""
30- return self ._state
20+ state : State = Field (default = {})
21+ user : User = Field (default = UnauthenticatedUser ())
You can’t perform that action at this time.
0 commit comments