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 Toloker.
It's addition to payment for completed tasks.
Parameters | Type | Description |
---|---|---|
user_id | Optional[str] | Toloker's 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 Toloker per time. |
private_comment | Optional[str] | Comments that are only visible to the requester. |
public_title | Optional[Dict[str, str]] | Message header for the Toloker. You can provide a title in several languages (the message will come in the Toloker's language). Format {'language': 'title', ... }. The language can be RU/EN/TR/ID/FR. |
public_message | Optional[Dict[str, str]] | Message text for the Toloker. You can provide text in several languages (the message will come in the Toloker'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 Toloker. To award a bonus without a message, specify null for |
assignment_id | Optional[str] | ID of the Toloker's response to the task a reward is issued for. |
id | Optional[str] | Internal ID of the issued bonus. Read-only field. |
created | Optional[datetime] | Date the bonus was awarded, in UTC. Read-only field. |
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 Toloker', }, 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 заданий', } ))