-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support batches API #1062
base: main
Are you sure you want to change the base?
Support batches API #1062
Conversation
daf6e60
to
cbb59ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batches are made of tasks, so it made sense to me for them to be handled by the TaskHandler, and be tested side by side with tasks.
As always, let me know if I did something stupid 😄
@@ -113,3 +113,46 @@ def __init__(self, resp: Dict[str, Any]) -> None: | |||
self.total: int = resp["total"] | |||
self.from_: int = resp["from"] | |||
self.next_: int = resp["next"] | |||
|
|||
|
|||
class Batch(CamelBase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept this class mostly the same as the Task model, including (some) of the validations.
I used Optional[*]
instead of the Union[*, None]
which was widely used in Task.
|
||
class Batch(CamelBase): | ||
uid: int | ||
details: Optional[Dict[str, Any]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if any of this is legacy syntax, I tried to maintain the same style as Task as much as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though in the previous PR I would have just done:
details: Dict[str, Any]
Additionally, I'm assuming Dict
is fine here (instead of Mapping
) since we know that we get Dict
s as responses from web requests.
Pull Request
Related issue
Fixes #1050