UserBonus
toloka.client.user_bonus.UserBonus
| Source code
UserBonus(
self,
*,
user_id: Optional[str] = None,
amount: Optional[Decimal] = None,
private_comment: Optional[str] = None,
public_title: Optional[Dict[str, str]] = None,
public_message: Optional[Dict[str, str]] = None,
without_message: Optional[bool] = None,
assignment_id: Optional[str] = None,
id: Optional[str] = None,
created: Optional[datetime] = None
)
Issuing a bonus to a specific performer
It's addition to payment for completed tasks.
Parameters Description
Parameters | Type | Description |
---|---|---|
user_id |
Optional[str] | Performer ID to whom the bonus will be issued. |
amount |
Optional[Decimal] | The bonus amount in dollars. Can be from 0.01 to 100 dollars per user per time. |
private_comment |
Optional[str] | Comments that are only visible to the requester. |
public_title |
Optional[Dict[str, str]] | Message header for the user. You can provide a title in several languages (the message will come in the user's language). Format {'language': 'title', ... }. The language can be RU/EN/TR/ID/FR. |
public_message |
Optional[Dict[str, str]] | Message text for the user. You can provide text in several languages (the message will come in the user's language). Format {'language': 'message', ... }. The language can be RU/EN/TR/ID/FR. |
without_message |
Optional[bool] | Do not send a bonus message to the user. To award a bonus without a message, specify null for public_title and public_message and True for without_message. |
assignment_id |
Optional[str] | The answer to the task for which this bonus was issued. |
id |
Optional[str] | Internal ID of the issued bonus. Read only. |
created |
Optional[datetime] | Date the bonus was awarded, in UTC. Read only. |
Examples:
How to create bonus with message for specific assignment.
new_bonus = toloka_client.create_user_bonus(
UserBonus(
user_id='1',
amount='0.50',
public_title={
'EN': 'Perfect job!',
},
public_message={
'EN': 'You are the best performer EVER',
},
assignment_id='012345'
)
)
How to create bonus with message in several languages.
new_bonus = toloka_client.create_user_bonus(
UserBonus(
user_id='1',
amount='0.10',
public_title={
'EN': 'Good Job!',
'RU': 'Молодец!',
},
public_message={
'EN': 'Ten tasks completed',
'RU': 'Выполнено 10 заданий',
}
)
)