-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmethods.py
More file actions
37 lines (25 loc) · 1.26 KB
/
Copy pathmethods.py
File metadata and controls
37 lines (25 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from typing import Optional
from pydantic import BaseModel, Field, field_serializer
from .tasks.task import TaskPayload
class GetBalancePayload(BaseModel):
"""
Represents a payload for retrieving the balance.
Attributes:
clientKey (str): The key representing the client, used for identifying
the client in balance-related operations.
"""
clientKey: str = Field(..., description="Client key")
class GetTaskResultPayload(BaseModel):
clientKey: str = Field(..., description="Client key")
taskId: int = Field(..., description="ID which was obtained from create task method.")
class ReportIncorrectCaptchaPayload(BaseModel):
clientKey: str = Field(..., description="Client key")
taskId: int = Field(..., description="ID of the task to report as incorrect.")
class CreateTaskPayload(BaseModel):
clientKey: str = Field(..., description="Client key")
task: TaskPayload = Field(..., description="Task data")
callbackUrl: Optional[str] = Field(default=None,
description="Web address for sending the captcha task result. Data is sent by POST request.")
@field_serializer("task")
def serialize_task(self, task: TaskPayload, _info) -> dict:
return task.to_request()