11from dataclasses import dataclass
2+ from typing import Any
23
34from ..bound import Bound
45from .order import Order
@@ -15,42 +16,8 @@ class ReadEventsOptions:
1516 upper_bound : Bound | None = None
1617 from_latest_event : ReadFromLatestEvent | None = None
1718
18- def validate (self ) -> None :
19- # Update validation logic for new object types
20- if self .lower_bound is not None and not isinstance (self .lower_bound , Bound ):
21- raise ValidationError (
22- 'ReadEventOptions are invalid: lower_bound must be a Bound object.'
23- )
24-
25- if self .upper_bound is not None and not isinstance (self .upper_bound , Bound ):
26- raise ValidationError (
27- 'ReadEventOptions are invalid: upper_bound must be a Bound object.'
28- )
29-
30- if self .from_latest_event is not None :
31- if self .lower_bound is not None :
32- raise ValidationError (
33- 'ReadEventsOptions are invalid: '
34- 'lowerBound and fromLatestEvent are mutually exclusive'
35- )
36-
37- try :
38- validate_subject (self .from_latest_event .subject )
39- except ValidationError as validation_error :
40- raise ValidationError (
41- f'ReadEventsOptions are invalid: '
42- f'from_latest_event.subject: { str (validation_error )} '
43- ) from validation_error
44-
45- # Add validation for empty type too
46- if not self .from_latest_event .type :
47- raise ValidationError (
48- 'ReadEventsOptions are invalid: '
49- 'from_latest_event.type cannot be empty'
50- )
51-
52- def to_json (self ):
53- json = {
19+ def to_json (self ) -> dict [str , Any ]:
20+ json : dict [str , Any ] = {
5421 'recursive' : self .recursive
5522 }
5623
0 commit comments