Trait
- class q2_smart.ts_endpoints.traits.UserTrait(trait_id, trait_value)[source]
Bases:
objectModel that describes the payload for the set_user_traits endpoint.
-
trait_id:
str The id of the trait being set for the user
-
trait_value:
str|bool|float|int The value of the trait. The data type depends on the trait being set.
-
trait_id:
- class q2_smart.ts_endpoints.traits.TraitBatch(user_id, trait_value)[source]
Bases:
objectModel that describes the payload for the set_trait_batch endpoint.
-
user_id:
int The user id the trait is being set for
-
trait_value:
str|bool|float|int The value of the trait. The data type depends on the trait being set.
-
user_id:
- class q2_smart.ts_endpoints.traits.Traits(logger, config, cache)[source]
Bases:
TSEndpoint- async set_trait(trait_id, user_id)[source]
Deprecated. Please use set_user_traits instead.
- Return type:
bool
- property mock_set_trait: dict
- async set_user_traits(user_id, user_traits)[source]
Set multiple traits for a specific user in batch.
- Parameters:
user_id (
int) – The ID of the user to set traits foruser_traits (
list[UserTrait]) – List of UserTrait objects containing trait_id and trait_value pairs
- Return type:
dict- Returns:
Response data indicating the number of success, or error information
- property mock_set_user_traits: dict
- async set_trait_batch(trait_id, trait_batch)[source]
Set a specific trait for multiple users in batch.
- Parameters:
trait_id (
str) – The ID of the trait to settrait_batch (
list[TraitBatch]) – List of TraitBatch objects containing user_id and trait_value pairs
- Return type:
dict- Returns:
Response data indicating the number of successfully set traits, and any error information
- property mock_set_trait_batch: dict