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
)

A bonus payment to a Toloker.

Learn more about Bonuses.

Parameters description

ParametersTypeDescription
idOptional[str]

The ID of the bonus.

user_idOptional[str]

The ID of the Toloker.

amountOptional[Decimal]

The amount of the bonus in US dollars.

assignment_idOptional[str]

The ID of the assignment the bonus is issued for.

private_commentOptional[str]

A comment visible to the requester only.

without_messageOptional[bool]
  • False — A message is sent to the Toloker when the bonus is issued.
  • True — There is no message sent to the Toloker.

Default value: False.

public_titleOptional[Dict[str, str]]

A message title. The title can be provided in several languages.

public_messageOptional[Dict[str, str]]

A message text. It can be provided in several languages.

createdOptional[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 Decimal
new_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

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming