def _create_from_draft(
     self, obj: types.SubscriptionDraft, id: typing.Optional[str] = None
 ) -> types.Subscription:
     object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4())
     return types.Subscription(
         id=str(object_id),
         version=1,
         created_at=datetime.datetime.now(),
         last_modified_at=datetime.datetime.now(),
         key=obj.key,
         changes=obj.changes,
         destination=obj.destination,
         messages=obj.messages,
     )
Exemple #2
0
 def post_load(self, data, **kwargs):
     return types.Subscription(**data)