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)
A bonus payment to a Toloker.
Learn more about Bonuses.
Parameters | Type | Description |
---|---|---|
id | Optional[str] | The ID of the bonus. |
user_id | Optional[str] | The ID of the Toloker. |
amount | Optional[Decimal] | The amount of the bonus in US dollars. |
assignment_id | Optional[str] | The ID of the assignment the bonus is issued for. |
private_comment | Optional[str] | A comment visible to the requester only. |
without_message | Optional[bool] |
Default value: |
public_title | Optional[Dict[str, str]] | A message title. The title can be provided in several languages. |
public_message | Optional[Dict[str, str]] | A message text. It can be provided in several languages. |
created | Optional[datetime] | The UTC date and time when the bonus was issued. Read-only field. |
Examples:
An example of issuing a bonus. A message to a Toloker is prepared in two languages.
from decimal import Decimalnew_bonus = toloka_client.create_user_bonus( toloka.client.UserBonus( user_id='a1b0b42923c429daa2c764d7ccfc364d', amount=Decimal('0.50'), public_title={ 'EN': 'Good Job!', 'RU': 'Молодец!', }, public_message={ 'EN': 'Ten tasks were completed', 'RU': 'Выполнено 10 заданий', }, assignment_id='000015fccc--63bfc4c358d7a46c32a7b233' ))
Last updated: August 28, 2023