From 0cff5f874b89a68951fe0aef74980eca1518dda2 Mon Sep 17 00:00:00 2001 From: Talon-One SDK Generator Date: Wed, 29 Apr 2026 09:20:39 +0000 Subject: [PATCH] update to 26.09.0 --- .github/ISSUE_TEMPLATE/bug_report.yml | 44 ++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .gitlab-ci.yml | 6 +- .openapi-generator/FILES | 20 +++ .openapi-generator/VERSION | 2 +- .travis.yml | 4 +- MIGRATION.md | 16 +- README.md | 8 +- docs/Audience.md | 1 + docs/CampaignEligibility.md | 40 +++++ docs/CampaignEligibilityDetails.md | 31 ++++ docs/CampaignEligibilityFailureDetails.md | 30 ++++ docs/CustomerProfileIntegrationResponseV2.md | 1 + docs/IntegrationApi.md | 2 + docs/IntegrationCampaign.md | 3 +- docs/IntegrationEventV2Response.md | 1 + docs/IntegrationEventV3Response.md | 1 + docs/IntegrationResponse.md | 1 + docs/IntegrationStateV2.md | 1 + docs/ManagementApi.md | 18 ++- docs/MultipleAudiencesItem.md | 1 + docs/NewAudience.md | 1 + docs/NewInternalAudience.md | 1 + docs/NewMultipleAudiencesItem.md | 1 + docs/NewReward.md | 2 + docs/Reward.md | 2 + docs/RuleEligibility.md | 32 ++++ docs/RuleEligibilityFailureDetails.md | 37 +++++ docs/RuleMetadata.md | 1 + docs/UpdateAudience.md | 1 + docs/UpdateReward.md | 33 ++++ pyproject.toml | 2 +- setup.py | 2 +- talon_one/__init__.py | 14 +- talon_one/api/integration_api.py | 6 + talon_one/api/management_api.py | 51 +++++++ talon_one/api_client.py | 34 ++--- talon_one/configuration.py | 4 +- talon_one/models/__init__.py | 6 + talon_one/models/account_additional_cost.py | 6 + talon_one/models/achievement.py | 3 + talon_one/models/achievement_base.py | 3 + talon_one/models/achievement_base_v2.py | 3 + .../achievement_progress_with_definition.py | 3 + talon_one/models/achievement_status_entry.py | 3 + talon_one/models/achievement_v2.py | 3 + .../models/add_loyalty_points_effect_props.py | 3 + talon_one/models/attribute.py | 6 + talon_one/models/audience.py | 4 +- talon_one/models/campaign_collection.py | 3 + .../campaign_collection_without_payload.py | 3 + talon_one/models/campaign_eligibility.py | 143 ++++++++++++++++++ .../models/campaign_eligibility_details.py | 96 ++++++++++++ .../campaign_eligibility_failure_details.py | 95 ++++++++++++ .../models/campaign_template_collection.py | 3 + .../card_ledger_transaction_log_entry.py | 3 + ...r_transaction_log_entry_integration_api.py | 3 + talon_one/models/code_generator_settings.py | 3 + talon_one/models/collection.py | 3 + .../models/collection_without_payload.py | 3 + talon_one/models/create_achievement.py | 3 + talon_one/models/create_achievement_v2.py | 3 + talon_one/models/custom_effect.py | 6 + ...customer_profile_integration_request_v2.py | 4 +- ...ustomer_profile_integration_response_v2.py | 12 +- .../deduct_loyalty_points_effect_props.py | 3 + talon_one/models/generate_loyalty_card.py | 3 + talon_one/models/integration_campaign.py | 16 +- .../models/integration_event_v2_request.py | 4 +- .../models/integration_event_v2_response.py | 12 +- .../models/integration_event_v3_response.py | 12 +- talon_one/models/integration_request.py | 4 +- talon_one/models/integration_response.py | 12 +- talon_one/models/integration_state_v2.py | 12 +- talon_one/models/loyalty_card.py | 9 ++ talon_one/models/loyalty_card_batch.py | 3 + .../models/loyalty_program_transaction.py | 3 + talon_one/models/multiple_audiences_item.py | 4 +- talon_one/models/new_additional_cost.py | 6 + talon_one/models/new_application.py | 3 + talon_one/models/new_attribute.py | 6 + talon_one/models/new_audience.py | 6 +- talon_one/models/new_campaign_collection.py | 3 + talon_one/models/new_collection.py | 3 + talon_one/models/new_custom_effect.py | 6 + talon_one/models/new_internal_audience.py | 8 +- .../models/new_multiple_audiences_item.py | 6 +- talon_one/models/new_price_type.py | 3 + talon_one/models/new_reward.py | 24 ++- talon_one/models/new_secondary_deployment.py | 3 + talon_one/models/new_webhook.py | 3 + talon_one/models/price_type.py | 3 + talon_one/models/response_content_object.py | 4 +- talon_one/models/reward.py | 22 ++- ...lback_added_loyalty_points_effect_props.py | 3 + ...ck_deducted_loyalty_points_effect_props.py | 3 + talon_one/models/rule_eligibility.py | 96 ++++++++++++ .../rule_eligibility_failure_details.py | 109 +++++++++++++ talon_one/models/rule_metadata.py | 14 +- talon_one/models/secondary_deployment.py | 3 + talon_one/models/transfer_loyalty_card.py | 3 + talon_one/models/update_achievement.py | 3 + talon_one/models/update_achievement_v2.py | 3 + talon_one/models/update_audience.py | 10 +- talon_one/models/update_custom_effect.py | 6 + talon_one/models/update_reward.py | 120 +++++++++++++++ talon_one/models/webhook.py | 3 + .../webhook_authentication_webhook_ref.py | 3 + ...bhook_with_outgoing_integration_details.py | 3 + test/test_audience.py | 1 + test/test_campaign_eligibility.py | 91 +++++++++++ test/test_campaign_eligibility_details.py | 55 +++++++ ...st_campaign_eligibility_failure_details.py | 52 +++++++ ...ustomer_profile_integration_response_v2.py | 3 + test/test_integration_campaign.py | 15 +- test/test_integration_event_v2_response.py | 3 + test/test_integration_event_v3_response.py | 3 + test/test_integration_response.py | 3 + test/test_integration_state_v2.py | 3 + test/test_multiple_audiences_item.py | 1 + test/test_new_audience.py | 1 + test/test_new_internal_audience.py | 3 +- test/test_new_multiple_audiences_item.py | 1 + test/test_new_reward.py | 23 ++- test/test_reward.py | 21 +++ test/test_rule_eligibility.py | 62 ++++++++ test/test_rule_eligibility_failure_details.py | 60 ++++++++ test/test_rule_metadata.py | 8 +- test/test_update_audience.py | 3 +- test/test_update_reward.py | 76 ++++++++++ 130 files changed, 1873 insertions(+), 88 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 docs/CampaignEligibility.md create mode 100644 docs/CampaignEligibilityDetails.md create mode 100644 docs/CampaignEligibilityFailureDetails.md create mode 100644 docs/RuleEligibility.md create mode 100644 docs/RuleEligibilityFailureDetails.md create mode 100644 docs/UpdateReward.md create mode 100644 talon_one/models/campaign_eligibility.py create mode 100644 talon_one/models/campaign_eligibility_details.py create mode 100644 talon_one/models/campaign_eligibility_failure_details.py create mode 100644 talon_one/models/rule_eligibility.py create mode 100644 talon_one/models/rule_eligibility_failure_details.py create mode 100644 talon_one/models/update_reward.py create mode 100644 test/test_campaign_eligibility.py create mode 100644 test/test_campaign_eligibility_details.py create mode 100644 test/test_campaign_eligibility_failure_details.py create mode 100644 test/test_rule_eligibility.py create mode 100644 test/test_rule_eligibility_failure_details.py create mode 100644 test/test_update_reward.py diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..195c8cf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,44 @@ +name: Bug report +description: Report a reproducible bug +title: "[Bug] " +labels: + - bug + +body: + - type: markdown + attributes: + value: | + 🙏 **Thanks for reporting this issue.** + + We will review it and aim to provide a fix within the next **2 weeks**. + + - type: textarea + id: summary + attributes: + label: Summary + description: Describe the problem clearly. + placeholder: | + Describe the problem clearly. + + - type: textarea + id: steps + attributes: + label: Steps to reproduce + placeholder: | + 1. Go to ... + 2. Click ... + 3. Observe ... + + - type: textarea + id: expected + attributes: + label: Expected behavior + placeholder: | + What should have happened? + + - type: textarea + id: actual + attributes: + label: Actual behavior + placeholder: | + What happened instead? diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..ec4bb38 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f48af4..b904e5d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,9 +14,6 @@ stages: - pip install -r test-requirements.txt - pytest --cov=talon_one -pytest-3.9: - extends: .pytest - image: python:3.9-alpine pytest-3.10: extends: .pytest image: python:3.10-alpine @@ -29,3 +26,6 @@ pytest-3.12: pytest-3.13: extends: .pytest image: python:3.13-alpine +pytest-3.14: + extends: .pytest + image: python:3.14-alpine diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 69acaf1..d8a7003 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,3 +1,5 @@ +.github/ISSUE_TEMPLATE/bug_report.yml +.github/ISSUE_TEMPLATE/config.yml .github/workflows/autorelease.yml .github/workflows/publish_to_pypi.yml .github/workflows/test.yml @@ -119,6 +121,9 @@ docs/CampaignDeletedNotificationItem.md docs/CampaignDetail.md docs/CampaignEditedNotification.md docs/CampaignEditedNotificationItem.md +docs/CampaignEligibility.md +docs/CampaignEligibilityDetails.md +docs/CampaignEligibilityFailureDetails.md docs/CampaignEntity.md docs/CampaignEvaluationGroup.md docs/CampaignEvaluationPosition.md @@ -588,6 +593,8 @@ docs/RollbackDiscountEffectProps.md docs/RollbackIncreasedAchievementProgressEffectProps.md docs/RollbackReferralEffectProps.md docs/Rule.md +docs/RuleEligibility.md +docs/RuleEligibilityFailureDetails.md docs/RuleFailureReason.md docs/RuleMetadata.md docs/Ruleset.md @@ -694,6 +701,7 @@ docs/UpdatePicklist.md docs/UpdatePriceType.md docs/UpdateReferral.md docs/UpdateReferralBatch.md +docs/UpdateReward.md docs/UpdateRole.md docs/UpdateStore.md docs/UpdateUser.md @@ -833,6 +841,9 @@ talon_one/models/campaign_deleted_notification_item.py talon_one/models/campaign_detail.py talon_one/models/campaign_edited_notification.py talon_one/models/campaign_edited_notification_item.py +talon_one/models/campaign_eligibility.py +talon_one/models/campaign_eligibility_details.py +talon_one/models/campaign_eligibility_failure_details.py talon_one/models/campaign_entity.py talon_one/models/campaign_evaluation_group.py talon_one/models/campaign_evaluation_position.py @@ -1300,6 +1311,8 @@ talon_one/models/rollback_discount_effect_props.py talon_one/models/rollback_increased_achievement_progress_effect_props.py talon_one/models/rollback_referral_effect_props.py talon_one/models/rule.py +talon_one/models/rule_eligibility.py +talon_one/models/rule_eligibility_failure_details.py talon_one/models/rule_failure_reason.py talon_one/models/rule_metadata.py talon_one/models/ruleset.py @@ -1406,6 +1419,7 @@ talon_one/models/update_picklist.py talon_one/models/update_price_type.py talon_one/models/update_referral.py talon_one/models/update_referral_batch.py +talon_one/models/update_reward.py talon_one/models/update_role.py talon_one/models/update_store.py talon_one/models/update_user.py @@ -1534,6 +1548,9 @@ test/test_campaign_deleted_notification_item.py test/test_campaign_detail.py test/test_campaign_edited_notification.py test/test_campaign_edited_notification_item.py +test/test_campaign_eligibility.py +test/test_campaign_eligibility_details.py +test/test_campaign_eligibility_failure_details.py test/test_campaign_entity.py test/test_campaign_evaluation_group.py test/test_campaign_evaluation_position.py @@ -2003,6 +2020,8 @@ test/test_rollback_discount_effect_props.py test/test_rollback_increased_achievement_progress_effect_props.py test/test_rollback_referral_effect_props.py test/test_rule.py +test/test_rule_eligibility.py +test/test_rule_eligibility_failure_details.py test/test_rule_failure_reason.py test/test_rule_metadata.py test/test_ruleset.py @@ -2109,6 +2128,7 @@ test/test_update_picklist.py test/test_update_price_type.py test/test_update_referral.py test/test_update_referral_batch.py +test/test_update_reward.py test/test_update_role.py test/test_update_store.py test/test_update_user.py diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index a29ba3d..696eaac 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.21.0 +7.22.0 diff --git a/.travis.yml b/.travis.yml index 1086a86..6b59387 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ # ref: https://docs.travis-ci.com/user/languages/python language: python python: - - "3.9" - "3.10" - "3.11" - "3.12" - "3.13" + - "3.14" # uncomment the following if needed - #- "3.13-dev" # 3.13 development branch + #- "3.14-dev" # 3.14 development branch #- "nightly" # nightly build # command to install dependencies install: diff --git a/MIGRATION.md b/MIGRATION.md index 0876707..9090e12 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -24,12 +24,14 @@ pip install talon-one-sdk ## Authentication -Authentication configuration has changed to use scheme-specific keys: +Authentication configuration has changed to use scheme-specific keys. + +The authentication scheme in the new SDK is `api_key_v1` (previously `Authorization`). **Before** ```python -# Create configuration with your host destination and authorization using management_key +# Create configuration with your host destination and authorization using api_key_v1 configuration = talon_one.Configuration( host="https://yourbaseurl.talon.one", api_key_prefix={"Authorization": "ApiKey-v1"}, @@ -40,7 +42,7 @@ configuration = talon_one.Configuration( **After** ```python -# Create configuration with your host destination and authorization using management_key +# Create configuration with your host destination and authorization using api_key_v1 configuration = talon_one.Configuration( host="https://yourbaseurl.talon.one", api_key_prefix={"api_key_v1": "ApiKey-v1"}, @@ -48,14 +50,6 @@ configuration = talon_one.Configuration( ) ``` -**Available authentication schemes:** - -| Scheme | Old Key | New Key | Use Case | -| ---------------- | --------------- | ---------------- | ---------------------------------- | -| `api_key_v1` | `Authorization` | `api_key_v1` | Integration API | -| `management_key` | `Authorization` | `management_key` | Management API with management key | -| `manager_auth` | `Authorization` | `manager_auth` | Management API with session token | - ## Type validation and models All models now use [Pydantic](https://docs.pydantic.dev/latest/) v2 with strict runtime diff --git a/README.md b/README.md index 12de9b0..6369a39 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ import talon_one from pprint import pprint import json -# Create configuration with your host destination and authorization using management_key +# Create configuration with your host destination and authorization using api_key_v1 configuration = talon_one.Configuration( host = "https://yourbaseurl.talon.one", # No trailing slash! api_key_prefix = { @@ -490,6 +490,9 @@ Class | Method | HTTP request | Description - [CampaignDetail](docs/CampaignDetail.md) - [CampaignEditedNotification](docs/CampaignEditedNotification.md) - [CampaignEditedNotificationItem](docs/CampaignEditedNotificationItem.md) +- [CampaignEligibility](docs/CampaignEligibility.md) +- [CampaignEligibilityDetails](docs/CampaignEligibilityDetails.md) +- [CampaignEligibilityFailureDetails](docs/CampaignEligibilityFailureDetails.md) - [CampaignEntity](docs/CampaignEntity.md) - [CampaignEvaluationGroup](docs/CampaignEvaluationGroup.md) - [CampaignEvaluationPosition](docs/CampaignEvaluationPosition.md) @@ -957,6 +960,8 @@ Class | Method | HTTP request | Description - [RollbackIncreasedAchievementProgressEffectProps](docs/RollbackIncreasedAchievementProgressEffectProps.md) - [RollbackReferralEffectProps](docs/RollbackReferralEffectProps.md) - [Rule](docs/Rule.md) +- [RuleEligibility](docs/RuleEligibility.md) +- [RuleEligibilityFailureDetails](docs/RuleEligibilityFailureDetails.md) - [RuleFailureReason](docs/RuleFailureReason.md) - [RuleMetadata](docs/RuleMetadata.md) - [Ruleset](docs/Ruleset.md) @@ -1063,6 +1068,7 @@ Class | Method | HTTP request | Description - [UpdatePriceType](docs/UpdatePriceType.md) - [UpdateReferral](docs/UpdateReferral.md) - [UpdateReferralBatch](docs/UpdateReferralBatch.md) +- [UpdateReward](docs/UpdateReward.md) - [UpdateRole](docs/UpdateRole.md) - [UpdateStore](docs/UpdateStore.md) - [UpdateUser](docs/UpdateUser.md) diff --git a/docs/Audience.md b/docs/Audience.md index 71975a2..aec0634 100644 --- a/docs/Audience.md +++ b/docs/Audience.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **name** | **str** | The human-friendly display name for this audience. | **sandbox** | **bool** | Indicates if this is a live or sandbox Application. | [optional] **description** | **str** | A description of the audience. | [optional] +**subscribed_applications_ids** | **List[int]** | A list of the IDs of the Applications that are connected to this audience. | [optional] **integration** | **str** | The Talon.One-supported [3rd-party platform](https://docs.talon.one/docs/dev/technology-partners/overview) that this audience was created in. For example, `mParticle`, `Segment`, `Shopify`, `Braze`, or `Iterable`. **Note:** If you do not integrate with any of these platforms, do not use this property. | [optional] **integration_id** | **str** | The ID of this audience in the third-party integration. **Note:** To create an audience that doesn't come from a 3rd party platform, do not use this property. | [optional] **created_in3rd_party** | **bool** | Determines if this audience is a 3rd party audience or not. | [optional] diff --git a/docs/CampaignEligibility.md b/docs/CampaignEligibility.md new file mode 100644 index 0000000..5e121eb --- /dev/null +++ b/docs/CampaignEligibility.md @@ -0,0 +1,40 @@ +# CampaignEligibility + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Unique ID of Campaign. | +**application_id** | **int** | The ID of the Application that owns this entity. | +**name** | **str** | The name of the campaign. | +**description** | **str** | A detailed description of the campaign. | [optional] +**start_time** | **datetime** | Timestamp when the campaign will become active. | [optional] +**end_time** | **datetime** | Timestamp when the campaign will become inactive. | [optional] +**attributes** | **object** | Arbitrary properties associated with this campaign. | [optional] +**state** | **str** | The state of the campaign. | [default to 'enabled'] +**tags** | **List[str]** | A list of tags for the campaign. | +**features** | **List[str]** | The features enabled in this campaign. | +**rules** | [**List[RuleMetadata]**](RuleMetadata.md) | A list of rules containing customer-facing details of the rewards defined in the campaign. | [optional] +**eligibility** | [**List[CampaignEligibilityDetails]**](CampaignEligibilityDetails.md) | The customer's eligibility for each campaign in the current customer session. | + +## Example + +```python +from talon_one.models.campaign_eligibility import CampaignEligibility + +# TODO update the JSON string below +json = "{}" +# create an instance of CampaignEligibility from a JSON string +campaign_eligibility_instance = CampaignEligibility.from_json(json) +# print the JSON string representation of the object +print(CampaignEligibility.to_json()) + +# convert the object into a dict +campaign_eligibility_dict = campaign_eligibility_instance.to_dict() +# create an instance of CampaignEligibility from a dict +campaign_eligibility_from_dict = CampaignEligibility.from_dict(campaign_eligibility_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CampaignEligibilityDetails.md b/docs/CampaignEligibilityDetails.md new file mode 100644 index 0000000..8ba1ab4 --- /dev/null +++ b/docs/CampaignEligibilityDetails.md @@ -0,0 +1,31 @@ +# CampaignEligibilityDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**passed** | **bool** | Indicates whether the customer was eligible for the campaign in the current session. | +**coupon_code** | **str** | The coupon code used to check a customer's eligibility for the campaign in the current session, if applicable. | [optional] +**details** | [**CampaignEligibilityFailureDetails**](CampaignEligibilityFailureDetails.md) | The details about why the customer was not eligible for the campaign in the current session. Only returned when `passed` is `false`. | [optional] + +## Example + +```python +from talon_one.models.campaign_eligibility_details import CampaignEligibilityDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of CampaignEligibilityDetails from a JSON string +campaign_eligibility_details_instance = CampaignEligibilityDetails.from_json(json) +# print the JSON string representation of the object +print(CampaignEligibilityDetails.to_json()) + +# convert the object into a dict +campaign_eligibility_details_dict = campaign_eligibility_details_instance.to_dict() +# create an instance of CampaignEligibilityDetails from a dict +campaign_eligibility_details_from_dict = CampaignEligibilityDetails.from_dict(campaign_eligibility_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CampaignEligibilityFailureDetails.md b/docs/CampaignEligibilityFailureDetails.md new file mode 100644 index 0000000..3820eb8 --- /dev/null +++ b/docs/CampaignEligibilityFailureDetails.md @@ -0,0 +1,30 @@ +# CampaignEligibilityFailureDetails + +The details about why the customer was not eligible for the campaign in the current session. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**failure_code** | **str** | A code identifying why the customer was not eligible for the campaign. | + +## Example + +```python +from talon_one.models.campaign_eligibility_failure_details import CampaignEligibilityFailureDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of CampaignEligibilityFailureDetails from a JSON string +campaign_eligibility_failure_details_instance = CampaignEligibilityFailureDetails.from_json(json) +# print the JSON string representation of the object +print(CampaignEligibilityFailureDetails.to_json()) + +# convert the object into a dict +campaign_eligibility_failure_details_dict = campaign_eligibility_failure_details_instance.to_dict() +# create an instance of CampaignEligibilityFailureDetails from a dict +campaign_eligibility_failure_details_from_dict = CampaignEligibilityFailureDetails.from_dict(campaign_eligibility_failure_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CustomerProfileIntegrationResponseV2.md b/docs/CustomerProfileIntegrationResponseV2.md index 3052a8d..fbe2e88 100644 --- a/docs/CustomerProfileIntegrationResponseV2.md +++ b/docs/CustomerProfileIntegrationResponseV2.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **loyalty** | [**Loyalty**](Loyalty.md) | | [optional] **triggered_campaigns** | [**List[Campaign]**](Campaign.md) | | [optional] **rule_failure_reasons** | [**List[RuleFailureReason]**](RuleFailureReason.md) | | [optional] +**campaign_eligibility** | [**List[CampaignEligibility]**](CampaignEligibility.md) | | [optional] **awarded_giveaways** | [**List[Giveaway]**](Giveaway.md) | | [optional] **effects** | [**List[Effect]**](Effect.md) | The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects). | **created_coupons** | [**List[Coupon]**](Coupon.md) | | diff --git a/docs/IntegrationApi.md b/docs/IntegrationApi.md index 601ba9e..64badb7 100644 --- a/docs/IntegrationApi.md +++ b/docs/IntegrationApi.md @@ -3092,6 +3092,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | +**204** | No content | - | **400** | Bad request | - | **401** | Unauthorized - Invalid API key | - | **409** | Too many requests or limit reached - Avoid parallel requests. See the [docs](https://docs.talon.one/docs/dev/tutorials/integrating-talon-one#managing-parallel-requests). | - | @@ -3642,6 +3643,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | +**204** | No content | - | **400** | Bad request | - | **401** | Unauthorized - Invalid API key | - | diff --git a/docs/IntegrationCampaign.md b/docs/IntegrationCampaign.md index 74cbf51..2bc04fa 100644 --- a/docs/IntegrationCampaign.md +++ b/docs/IntegrationCampaign.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **application_id** | **int** | The ID of the Application that owns this entity. | **id** | **int** | Unique ID of Campaign. | -**name** | **str** | A user-facing name for this campaign. | +**name** | **str** | The name of the campaign. | **description** | **str** | A detailed description of the campaign. | [optional] **start_time** | **datetime** | Timestamp when the campaign will become active. | [optional] **end_time** | **datetime** | Timestamp when the campaign will become inactive. | [optional] @@ -15,6 +15,7 @@ Name | Type | Description | Notes **state** | **str** | The state of the campaign. | [default to 'enabled'] **tags** | **List[str]** | A list of tags for the campaign. | **features** | **List[str]** | The features enabled in this campaign. | +**rules** | [**List[RuleMetadata]**](RuleMetadata.md) | A list of rules containing customer-facing details of the rewards defined in the campaign. | [optional] ## Example diff --git a/docs/IntegrationEventV2Response.md b/docs/IntegrationEventV2Response.md index 9002e0b..ae47f32 100644 --- a/docs/IntegrationEventV2Response.md +++ b/docs/IntegrationEventV2Response.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **customer_profile** | [**CustomerProfile**](CustomerProfile.md) | The customer profile associated with the event. | [optional] **loyalty** | [**Loyalty**](Loyalty.md) | The loyalty program status of the customer. | [optional] **triggered_campaigns** | [**List[Campaign]**](Campaign.md) | The campaigns that were triggered as a result of processing the event. | [optional] +**campaign_eligibility** | [**List[CampaignEligibility]**](CampaignEligibility.md) | A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. | [optional] **effects** | [**List[Effect]**](Effect.md) | The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects). | **rule_failure_reasons** | [**List[RuleFailureReason]**](RuleFailureReason.md) | The reasons why certain rules were not triggered during the event processing. | [optional] **created_coupons** | [**List[Coupon]**](Coupon.md) | The coupons that were created during the event processing. | diff --git a/docs/IntegrationEventV3Response.md b/docs/IntegrationEventV3Response.md index dd269d4..e8f0880 100644 --- a/docs/IntegrationEventV3Response.md +++ b/docs/IntegrationEventV3Response.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **customer_profile** | [**CustomerProfile**](CustomerProfile.md) | The customer profile associated with the event. | [optional] **loyalty** | [**Loyalty**](Loyalty.md) | The loyalty program status of the customer. | [optional] **triggered_campaigns** | [**List[Campaign]**](Campaign.md) | The campaigns that were triggered as a result of processing the event. | [optional] +**campaign_eligibility** | [**List[CampaignEligibility]**](CampaignEligibility.md) | A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. | [optional] **effects** | [**List[Effect]**](Effect.md) | The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects). | **rule_failure_reasons** | [**List[RuleFailureReason]**](RuleFailureReason.md) | The reasons why certain rules were not triggered during the event processing. | [optional] **created_coupons** | [**List[Coupon]**](Coupon.md) | The coupons that were created during the event processing. | diff --git a/docs/IntegrationResponse.md b/docs/IntegrationResponse.md index 17e948f..888dca1 100644 --- a/docs/IntegrationResponse.md +++ b/docs/IntegrationResponse.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **customer_profile** | [**CustomerProfile**](CustomerProfile.md) | The customer profile associated with the event. | [optional] **loyalty** | [**Loyalty**](Loyalty.md) | The loyalty program status of the customer. | [optional] **triggered_campaigns** | [**List[Campaign]**](Campaign.md) | The campaigns that were triggered as a result of processing the event. | [optional] +**campaign_eligibility** | [**List[CampaignEligibility]**](CampaignEligibility.md) | A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. | [optional] **effects** | [**List[Effect]**](Effect.md) | The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects). | **rule_failure_reasons** | [**List[RuleFailureReason]**](RuleFailureReason.md) | The reasons why certain rules were not triggered during the event processing. | [optional] **created_coupons** | [**List[Coupon]**](Coupon.md) | The coupons that were created during the event processing. | diff --git a/docs/IntegrationStateV2.md b/docs/IntegrationStateV2.md index 0076288..291b0c0 100644 --- a/docs/IntegrationStateV2.md +++ b/docs/IntegrationStateV2.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **customer_profile** | [**CustomerProfile**](CustomerProfile.md) | The customer profile associated with the event. | [optional] **loyalty** | [**Loyalty**](Loyalty.md) | The loyalty program status of the customer. | [optional] **triggered_campaigns** | [**List[Campaign]**](Campaign.md) | The campaigns that were triggered as a result of processing the event. | [optional] +**campaign_eligibility** | [**List[CampaignEligibility]**](CampaignEligibility.md) | A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. | [optional] **effects** | [**List[Effect]**](Effect.md) | The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects). | **rule_failure_reasons** | [**List[RuleFailureReason]**](RuleFailureReason.md) | The reasons why certain rules were not triggered during the event processing. | [optional] **created_coupons** | [**List[Coupon]**](Coupon.md) | The coupons that were created during the event processing. | diff --git a/docs/ManagementApi.md b/docs/ManagementApi.md index 5d6a99e..de2e798 100644 --- a/docs/ManagementApi.md +++ b/docs/ManagementApi.md @@ -4496,7 +4496,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **export_loyalty_balance** -> str export_loyalty_balance(loyalty_program_id, end_date=end_date) +> str export_loyalty_balance(loyalty_program_id, end_date=end_date, balances=balances) Export customer loyalty balance to CSV @@ -4542,10 +4542,11 @@ with talon_one.ApiClient(configuration) as api_client: api_instance = talon_one.ManagementApi(api_client) loyalty_program_id = 'loyalty_program_id_example' # str | The identifier for the loyalty program. end_date = '2013-10-20T19:20:30+01:00' # datetime | Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. (optional) + balances = 'balances_example' # str | Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. (optional) try: # Export customer loyalty balance to CSV - api_response = api_instance.export_loyalty_balance(loyalty_program_id, end_date=end_date) + api_response = api_instance.export_loyalty_balance(loyalty_program_id, end_date=end_date, balances=balances) print("The response of ManagementApi->export_loyalty_balance:\n") pprint(api_response) except Exception as e: @@ -4561,6 +4562,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **loyalty_program_id** | **str**| The identifier for the loyalty program. | **end_date** | **datetime**| Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. | [optional] + **balances** | **str**| Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. | [optional] ### Return type @@ -4586,7 +4588,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **export_loyalty_balances** -> str export_loyalty_balances(loyalty_program_id, end_date=end_date) +> str export_loyalty_balances(loyalty_program_id, end_date=end_date, balances=balances) Export customer loyalty balances @@ -4640,10 +4642,11 @@ with talon_one.ApiClient(configuration) as api_client: api_instance = talon_one.ManagementApi(api_client) loyalty_program_id = 'loyalty_program_id_example' # str | The identifier for the loyalty program. end_date = '2013-10-20T19:20:30+01:00' # datetime | Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. (optional) + balances = 'balances_example' # str | Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. (optional) try: # Export customer loyalty balances - api_response = api_instance.export_loyalty_balances(loyalty_program_id, end_date=end_date) + api_response = api_instance.export_loyalty_balances(loyalty_program_id, end_date=end_date, balances=balances) print("The response of ManagementApi->export_loyalty_balances:\n") pprint(api_response) except Exception as e: @@ -4659,6 +4662,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **loyalty_program_id** | **str**| The identifier for the loyalty program. | **end_date** | **datetime**| Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. | [optional] + **balances** | **str**| Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. | [optional] ### Return type @@ -4684,7 +4688,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **export_loyalty_card_balances** -> str export_loyalty_card_balances(loyalty_program_id, end_date=end_date) +> str export_loyalty_card_balances(loyalty_program_id, end_date=end_date, balances=balances) Export all card transaction logs @@ -4739,10 +4743,11 @@ with talon_one.ApiClient(configuration) as api_client: api_instance = talon_one.ManagementApi(api_client) loyalty_program_id = 56 # int | Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint. end_date = '2013-10-20T19:20:30+01:00' # datetime | Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. (optional) + balances = 'balances_example' # str | Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. (optional) try: # Export all card transaction logs - api_response = api_instance.export_loyalty_card_balances(loyalty_program_id, end_date=end_date) + api_response = api_instance.export_loyalty_card_balances(loyalty_program_id, end_date=end_date, balances=balances) print("The response of ManagementApi->export_loyalty_card_balances:\n") pprint(api_response) except Exception as e: @@ -4758,6 +4763,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **loyalty_program_id** | **int**| Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint. | **end_date** | **datetime**| Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. | [optional] + **balances** | **str**| Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. | [optional] ### Return type diff --git a/docs/MultipleAudiencesItem.md b/docs/MultipleAudiencesItem.md index da2125c..440dc5f 100644 --- a/docs/MultipleAudiencesItem.md +++ b/docs/MultipleAudiencesItem.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **id** | **int** | The internal ID of this entity. | **created** | **datetime** | The time this entity was created. | **name** | **str** | The human-friendly display name for this audience. | +**subscribed_applications_ids** | **List[int]** | A list of the IDs of the Applications that are connected to this audience. | [optional] **integration_id** | **str** | The ID of this audience in the third-party integration. | [optional] **status** | **str** | Indicates whether the audience is new, updated or unmodified by the request. | diff --git a/docs/NewAudience.md b/docs/NewAudience.md index fa1838d..963aa45 100644 --- a/docs/NewAudience.md +++ b/docs/NewAudience.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **name** | **str** | The human-friendly display name for this audience. | **sandbox** | **bool** | Indicates if this is a live or sandbox Application. | [optional] **description** | **str** | A description of the audience. | [optional] +**subscribed_applications_ids** | **List[int]** | A list of the IDs of the Applications that are connected to this audience. | [optional] **integration** | **str** | The Talon.One-supported [3rd-party platform](https://docs.talon.one/docs/dev/technology-partners/overview) that this audience was created in. For example, `mParticle`, `Segment`, `Shopify`, `Braze`, or `Iterable`. **Note:** If you do not integrate with any of these platforms, do not use this property. | [optional] **integration_id** | **str** | The ID of this audience in the third-party integration. **Note:** To create an audience that doesn't come from a 3rd party platform, do not use this property. | [optional] **created_in3rd_party** | **bool** | Determines if this audience is a 3rd party audience or not. | [optional] diff --git a/docs/NewInternalAudience.md b/docs/NewInternalAudience.md index 6734a10..6c497a9 100644 --- a/docs/NewInternalAudience.md +++ b/docs/NewInternalAudience.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **name** | **str** | The human-friendly display name for this audience. | **sandbox** | **bool** | Indicates if this is a live or sandbox Application. | [optional] **description** | **str** | A description of the audience. | [optional] +**subscribed_applications_ids** | **List[int]** | A list of the IDs of the Applications that are connected to this audience. | [optional] ## Example diff --git a/docs/NewMultipleAudiencesItem.md b/docs/NewMultipleAudiencesItem.md index c83f915..3f48d71 100644 --- a/docs/NewMultipleAudiencesItem.md +++ b/docs/NewMultipleAudiencesItem.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | The human-friendly display name for this audience. | +**subscribed_applications_ids** | **List[int]** | A list of the IDs of the Applications that are connected to this audience. | [optional] **integration_id** | **str** | The ID of this audience in the third-party integration. | [optional] ## Example diff --git a/docs/NewReward.md b/docs/NewReward.md index cd811f9..1d1fce8 100644 --- a/docs/NewReward.md +++ b/docs/NewReward.md @@ -10,6 +10,8 @@ Name | Type | Description | Notes **description** | **str** | A description of the reward. | [optional] **application_ids** | **List[int]** | The IDs of the Applications this reward is connected to. **Note**: Currently, a reward can only be connected to one Application. | **sandbox** | **bool** | Indicates if this is a live or sandbox reward. Rewards of a given type can only be connected to Applications of the same type. | +**rule** | [**List[Rule]**](Rule.md) | Rule to apply. | [optional] +**bindings** | [**List[Binding]**](Binding.md) | A list of named variables created before the reward's rules are evaluated. Each binding pairs a name with a talang expression. The expression is evaluated once and its result is available by name in any rule condition or effect. Bindings must be defined outside of individual rules. | [optional] ## Example diff --git a/docs/Reward.md b/docs/Reward.md index bb12339..478f66d 100644 --- a/docs/Reward.md +++ b/docs/Reward.md @@ -13,6 +13,8 @@ Name | Type | Description | Notes **description** | **str** | A description of the reward. | [optional] **application_ids** | **List[int]** | The IDs of the Applications this reward is connected to. **Note**: Currently, a reward can only be connected to one Application. | **sandbox** | **bool** | Indicates if this is a live or sandbox reward. Rewards of a given type can only be connected to Applications of the same type. | +**rule** | [**List[Rule]**](Rule.md) | Rule to apply. | [optional] +**bindings** | [**List[Binding]**](Binding.md) | A list of named variables created before the reward's rules are evaluated. Each binding pairs a name with a talang expression. The expression is evaluated once and its result is available by name in any rule condition or effect. Bindings must be defined outside of individual rules. | [optional] **status** | **str** | The status of the reward. | ## Example diff --git a/docs/RuleEligibility.md b/docs/RuleEligibility.md new file mode 100644 index 0000000..cf3b44e --- /dev/null +++ b/docs/RuleEligibility.md @@ -0,0 +1,32 @@ +# RuleEligibility + +The customer's eligibility for a rule in the current session, based on whether all of the rule's conditions were met. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**passed** | **bool** | Indicates whether the customer was eligible for the rule in the current session, based on whether all of the rule's conditions were met. | +**coupon_code** | **str** | The coupon code used to check a customer's eligibility for the rule in the current session, if applicable. | [optional] +**details** | [**RuleEligibilityFailureDetails**](RuleEligibilityFailureDetails.md) | The details about why the customer was not eligible for the rule in the current session. Only returned when `passed` is `false`. | [optional] + +## Example + +```python +from talon_one.models.rule_eligibility import RuleEligibility + +# TODO update the JSON string below +json = "{}" +# create an instance of RuleEligibility from a JSON string +rule_eligibility_instance = RuleEligibility.from_json(json) +# print the JSON string representation of the object +print(RuleEligibility.to_json()) + +# convert the object into a dict +rule_eligibility_dict = rule_eligibility_instance.to_dict() +# create an instance of RuleEligibility from a dict +rule_eligibility_from_dict = RuleEligibility.from_dict(rule_eligibility_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RuleEligibilityFailureDetails.md b/docs/RuleEligibilityFailureDetails.md new file mode 100644 index 0000000..2a04374 --- /dev/null +++ b/docs/RuleEligibilityFailureDetails.md @@ -0,0 +1,37 @@ +# RuleEligibilityFailureDetails + +The details about why the customer was not eligible for the rule in the current session. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**failure_code** | **str** | A code identifying why the customer was not eligible for the rule in the current session. | +**coupon_id** | **int** | The ID of the coupon that was being evaluated when the rule failed. | [optional] +**coupon_value** | **str** | The coupon code that was being evaluated when the rule failed. | [optional] +**referral_id** | **int** | The ID of the referral that was being evaluated when the rule failed. | [optional] +**referral_value** | **str** | The referral code that was being evaluated when the rule failed. | [optional] +**condition_index** | **int** | The index of the condition that caused the rule to fail. | [optional] +**effect_index** | **int** | The index of the effect that caused the rule to fail. | [optional] +**details** | **str** | Additional details about the failure. | + +## Example + +```python +from talon_one.models.rule_eligibility_failure_details import RuleEligibilityFailureDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of RuleEligibilityFailureDetails from a JSON string +rule_eligibility_failure_details_instance = RuleEligibilityFailureDetails.from_json(json) +# print the JSON string representation of the object +print(RuleEligibilityFailureDetails.to_json()) + +# convert the object into a dict +rule_eligibility_failure_details_dict = rule_eligibility_failure_details_instance.to_dict() +# create an instance of RuleEligibilityFailureDetails from a dict +rule_eligibility_failure_details_from_dict = RuleEligibilityFailureDetails.from_dict(rule_eligibility_failure_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RuleMetadata.md b/docs/RuleMetadata.md index d7487d7..665e3bc 100644 --- a/docs/RuleMetadata.md +++ b/docs/RuleMetadata.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **display_name** | **str** | A customer-facing name for the rule. | [optional] **display_description** | **str** | A customer-facing description that explains the details of the rule. For example, this property can contain details about eligibility requirements, reward timelines, or terms and conditions. | [optional] **related_data** | **str** | Any additional data associated with the rule, such as an image URL, vendor name, or a content management system (CMS) ID. | [optional] +**eligibility** | [**List[RuleEligibility]**](RuleEligibility.md) | | [optional] ## Example diff --git a/docs/UpdateAudience.md b/docs/UpdateAudience.md index a233dca..0fd862a 100644 --- a/docs/UpdateAudience.md +++ b/docs/UpdateAudience.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | The human-friendly display name for this audience. | +**subscribed_applications_ids** | **List[int]** | A list of the IDs of the Applications that are connected to this audience. | [optional] ## Example diff --git a/docs/UpdateReward.md b/docs/UpdateReward.md new file mode 100644 index 0000000..9f454ef --- /dev/null +++ b/docs/UpdateReward.md @@ -0,0 +1,33 @@ +# UpdateReward + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the reward. | +**description** | **str** | A description of the reward. | [optional] +**status** | **str** | The status of the reward. | +**rule** | [**List[Rule]**](Rule.md) | Rule to apply. **Note**: The `bindings` field inside the rule must not be used in this endpoint. All bindings should be defined at the reward level via the top-level `bindings` field. | [optional] +**bindings** | [**List[Binding]**](Binding.md) | A list of named variables created before the reward's rules are evaluated. Each binding pairs a name with a talang expression. The expression is evaluated once and its result is available by name in any rule condition or effect. Bindings must be defined outside of individual rules. | [optional] + +## Example + +```python +from talon_one.models.update_reward import UpdateReward + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateReward from a JSON string +update_reward_instance = UpdateReward.from_json(json) +# print the JSON string representation of the object +print(UpdateReward.to_json()) + +# convert the object into a dict +update_reward_dict = update_reward_instance.to_dict() +# create an instance of UpdateReward from a dict +update_reward_from_dict = UpdateReward.from_dict(update_reward_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pyproject.toml b/pyproject.toml index e89d9ab..1ab7ea2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "talon-one-sdk" -version = "26.08.0" +version = "26.09.0" description = "Talon.One API" authors = [ {name = "OpenAPI Generator Community",email = "team@openapitools.org"}, diff --git a/setup.py b/setup.py index ce4c8d8..261cbc3 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ # http://pypi.python.org/pypi/setuptools NAME = "talon-one-sdk" -VERSION = "26.08.0" +VERSION = "26.09.0" # Get the long description from the README.md file here = pathlib.Path(__file__).parent.resolve() diff --git a/talon_one/__init__.py b/talon_one/__init__.py index 813633f..9edc444 100644 --- a/talon_one/__init__.py +++ b/talon_one/__init__.py @@ -14,7 +14,7 @@ """ # noqa: E501 -__version__ = "26.08.0" +__version__ = "26.09.0" # Define package exports __all__ = [ @@ -140,6 +140,9 @@ "CampaignDetail", "CampaignEditedNotification", "CampaignEditedNotificationItem", + "CampaignEligibility", + "CampaignEligibilityDetails", + "CampaignEligibilityFailureDetails", "CampaignEntity", "CampaignEvaluationGroup", "CampaignEvaluationPosition", @@ -607,6 +610,8 @@ "RollbackIncreasedAchievementProgressEffectProps", "RollbackReferralEffectProps", "Rule", + "RuleEligibility", + "RuleEligibilityFailureDetails", "RuleFailureReason", "RuleMetadata", "Ruleset", @@ -713,6 +718,7 @@ "UpdatePriceType", "UpdateReferral", "UpdateReferralBatch", + "UpdateReward", "UpdateRole", "UpdateStore", "UpdateUser", @@ -855,6 +861,9 @@ from talon_one.models.campaign_detail import CampaignDetail as CampaignDetail from talon_one.models.campaign_edited_notification import CampaignEditedNotification as CampaignEditedNotification from talon_one.models.campaign_edited_notification_item import CampaignEditedNotificationItem as CampaignEditedNotificationItem +from talon_one.models.campaign_eligibility import CampaignEligibility as CampaignEligibility +from talon_one.models.campaign_eligibility_details import CampaignEligibilityDetails as CampaignEligibilityDetails +from talon_one.models.campaign_eligibility_failure_details import CampaignEligibilityFailureDetails as CampaignEligibilityFailureDetails from talon_one.models.campaign_entity import CampaignEntity as CampaignEntity from talon_one.models.campaign_evaluation_group import CampaignEvaluationGroup as CampaignEvaluationGroup from talon_one.models.campaign_evaluation_position import CampaignEvaluationPosition as CampaignEvaluationPosition @@ -1322,6 +1331,8 @@ from talon_one.models.rollback_increased_achievement_progress_effect_props import RollbackIncreasedAchievementProgressEffectProps as RollbackIncreasedAchievementProgressEffectProps from talon_one.models.rollback_referral_effect_props import RollbackReferralEffectProps as RollbackReferralEffectProps from talon_one.models.rule import Rule as Rule +from talon_one.models.rule_eligibility import RuleEligibility as RuleEligibility +from talon_one.models.rule_eligibility_failure_details import RuleEligibilityFailureDetails as RuleEligibilityFailureDetails from talon_one.models.rule_failure_reason import RuleFailureReason as RuleFailureReason from talon_one.models.rule_metadata import RuleMetadata as RuleMetadata from talon_one.models.ruleset import Ruleset as Ruleset @@ -1428,6 +1439,7 @@ from talon_one.models.update_price_type import UpdatePriceType as UpdatePriceType from talon_one.models.update_referral import UpdateReferral as UpdateReferral from talon_one.models.update_referral_batch import UpdateReferralBatch as UpdateReferralBatch +from talon_one.models.update_reward import UpdateReward as UpdateReward from talon_one.models.update_role import UpdateRole as UpdateRole from talon_one.models.update_store import UpdateStore as UpdateStore from talon_one.models.update_user import UpdateUser as UpdateUser diff --git a/talon_one/api/integration_api.py b/talon_one/api/integration_api.py index b838003..a0aceb9 100644 --- a/talon_one/api/integration_api.py +++ b/talon_one/api/integration_api.py @@ -9300,6 +9300,7 @@ def track_event_v2( _response_types_map: Dict[str, Optional[str]] = { '200': "IntegrationEventV2Response", + '204': "str", '400': "ErrorResponseWithStatus", '401': "ErrorResponseWithStatus", '409': "UpdateCustomerProfileV2409Response", @@ -9382,6 +9383,7 @@ def track_event_v2_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "IntegrationEventV2Response", + '204': "str", '400': "ErrorResponseWithStatus", '401': "ErrorResponseWithStatus", '409': "UpdateCustomerProfileV2409Response", @@ -9464,6 +9466,7 @@ def track_event_v2_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "IntegrationEventV2Response", + '204': "str", '400': "ErrorResponseWithStatus", '401': "ErrorResponseWithStatus", '409': "UpdateCustomerProfileV2409Response", @@ -11144,6 +11147,7 @@ def update_customer_profiles_v2( _response_types_map: Dict[str, Optional[str]] = { '200': "MultipleCustomerProfileIntegrationResponseV2", + '204': "str", '400': "ErrorResponseWithStatus", '401': "ErrorResponseWithStatus", } @@ -11217,6 +11221,7 @@ def update_customer_profiles_v2_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "MultipleCustomerProfileIntegrationResponseV2", + '204': "str", '400': "ErrorResponseWithStatus", '401': "ErrorResponseWithStatus", } @@ -11290,6 +11295,7 @@ def update_customer_profiles_v2_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "MultipleCustomerProfileIntegrationResponseV2", + '204': "str", '400': "ErrorResponseWithStatus", '401': "ErrorResponseWithStatus", } diff --git a/talon_one/api/management_api.py b/talon_one/api/management_api.py index 4a528b3..a95fe19 100644 --- a/talon_one/api/management_api.py +++ b/talon_one/api/management_api.py @@ -14995,6 +14995,7 @@ def export_loyalty_balance( self, loyalty_program_id: Annotated[StrictStr, Field(description="The identifier for the loyalty program.")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15016,6 +15017,8 @@ def export_loyalty_balance( :type loyalty_program_id: str :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15042,6 +15045,7 @@ def export_loyalty_balance( _param = self._export_loyalty_balance_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15069,6 +15073,7 @@ def export_loyalty_balance_with_http_info( self, loyalty_program_id: Annotated[StrictStr, Field(description="The identifier for the loyalty program.")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15090,6 +15095,8 @@ def export_loyalty_balance_with_http_info( :type loyalty_program_id: str :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15116,6 +15123,7 @@ def export_loyalty_balance_with_http_info( _param = self._export_loyalty_balance_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15143,6 +15151,7 @@ def export_loyalty_balance_without_preload_content( self, loyalty_program_id: Annotated[StrictStr, Field(description="The identifier for the loyalty program.")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15164,6 +15173,8 @@ def export_loyalty_balance_without_preload_content( :type loyalty_program_id: str :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15190,6 +15201,7 @@ def export_loyalty_balance_without_preload_content( _param = self._export_loyalty_balance_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15212,6 +15224,7 @@ def _export_loyalty_balance_serialize( self, loyalty_program_id, end_date, + balances, _request_auth, _content_type, _headers, @@ -15249,6 +15262,10 @@ def _export_loyalty_balance_serialize( else: _query_params.append(('endDate', end_date)) + if balances is not None: + + _query_params.append(('balances', balances)) + # process the header parameters # process the form parameters # process the body parameter @@ -15291,6 +15308,7 @@ def export_loyalty_balances( self, loyalty_program_id: Annotated[StrictStr, Field(description="The identifier for the loyalty program.")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15312,6 +15330,8 @@ def export_loyalty_balances( :type loyalty_program_id: str :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15337,6 +15357,7 @@ def export_loyalty_balances( _param = self._export_loyalty_balances_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15364,6 +15385,7 @@ def export_loyalty_balances_with_http_info( self, loyalty_program_id: Annotated[StrictStr, Field(description="The identifier for the loyalty program.")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15385,6 +15407,8 @@ def export_loyalty_balances_with_http_info( :type loyalty_program_id: str :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15410,6 +15434,7 @@ def export_loyalty_balances_with_http_info( _param = self._export_loyalty_balances_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15437,6 +15462,7 @@ def export_loyalty_balances_without_preload_content( self, loyalty_program_id: Annotated[StrictStr, Field(description="The identifier for the loyalty program.")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15458,6 +15484,8 @@ def export_loyalty_balances_without_preload_content( :type loyalty_program_id: str :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. > - This parameter does not affect the `currentTier` field in the CSV file, which shows the customer's tier at the time of export. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. `currentBalance` is always returned. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15483,6 +15511,7 @@ def export_loyalty_balances_without_preload_content( _param = self._export_loyalty_balances_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15505,6 +15534,7 @@ def _export_loyalty_balances_serialize( self, loyalty_program_id, end_date, + balances, _request_auth, _content_type, _headers, @@ -15542,6 +15572,10 @@ def _export_loyalty_balances_serialize( else: _query_params.append(('endDate', end_date)) + if balances is not None: + + _query_params.append(('balances', balances)) + # process the header parameters # process the form parameters # process the body parameter @@ -15584,6 +15618,7 @@ def export_loyalty_card_balances( self, loyalty_program_id: Annotated[StrictInt, Field(description="Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint. ")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15605,6 +15640,8 @@ def export_loyalty_card_balances( :type loyalty_program_id: int :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15630,6 +15667,7 @@ def export_loyalty_card_balances( _param = self._export_loyalty_card_balances_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15657,6 +15695,7 @@ def export_loyalty_card_balances_with_http_info( self, loyalty_program_id: Annotated[StrictInt, Field(description="Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint. ")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15678,6 +15717,8 @@ def export_loyalty_card_balances_with_http_info( :type loyalty_program_id: int :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15703,6 +15744,7 @@ def export_loyalty_card_balances_with_http_info( _param = self._export_loyalty_card_balances_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15730,6 +15772,7 @@ def export_loyalty_card_balances_without_preload_content( self, loyalty_program_id: Annotated[StrictInt, Field(description="Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint. ")], end_date: Annotated[Optional[datetime], Field(description="Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. ")] = None, + balances: Annotated[Optional[StrictStr], Field(description="Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. ")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -15751,6 +15794,8 @@ def export_loyalty_card_balances_without_preload_content( :type loyalty_program_id: int :param end_date: Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. > [!note] **Note** > - This must be an RFC3339 timestamp string. > - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting > considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered. :type end_date: datetime + :param balances: Filters which balance fields are included in the CSV export. By default, all balance fields are included. When this parameter is provided, only the listed fields contain values and the rest are returned empty. Accepted values: - `currentBalance` - `pendingBalance` - `expiredBalance` - `spentBalance` - `negativeBalance` Multiple values must be provided as a comma-separated list. **Note:** - The `negativeBalance` value is not supported for card balance exports. - Providing an unsupported or invalid value returns a `400 Bad Request` error. + :type balances: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -15776,6 +15821,7 @@ def export_loyalty_card_balances_without_preload_content( _param = self._export_loyalty_card_balances_serialize( loyalty_program_id=loyalty_program_id, end_date=end_date, + balances=balances, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -15798,6 +15844,7 @@ def _export_loyalty_card_balances_serialize( self, loyalty_program_id, end_date, + balances, _request_auth, _content_type, _headers, @@ -15835,6 +15882,10 @@ def _export_loyalty_card_balances_serialize( else: _query_params.append(('endDate', end_date)) + if balances is not None: + + _query_params.append(('balances', balances)) + # process the header parameters # process the form parameters # process the body parameter diff --git a/talon_one/api_client.py b/talon_one/api_client.py index c6136c0..42a61b1 100644 --- a/talon_one/api_client.py +++ b/talon_one/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/26.08.0/python' + self.user_agent = 'OpenAPI-Generator/26.09.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): @@ -371,28 +371,24 @@ def sanitize_for_serialization(self, obj): return obj.isoformat() elif isinstance(obj, decimal.Decimal): return str(obj) - elif isinstance(obj, dict): - obj_dict = obj + return { + key: self.sanitize_for_serialization(val) + for key, val in obj.items() + } + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): - obj_dict = obj.to_dict() - else: - obj_dict = obj.__dict__ + obj_dict = obj.__dict__ - if isinstance(obj_dict, list): - # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() - return self.sanitize_for_serialization(obj_dict) + return self.sanitize_for_serialization(obj_dict) - return { - key: self.sanitize_for_serialization(val) - for key, val in obj_dict.items() - } def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. diff --git a/talon_one/configuration.py b/talon_one/configuration.py index 2c013fe..fbc83c5 100644 --- a/talon_one/configuration.py +++ b/talon_one/configuration.py @@ -214,7 +214,7 @@ def __init__( server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, ignore_operation_servers: bool=False, ssl_ca_cert: Optional[str]=None, - retries: Optional[Union[int, Any]] = None, + retries: Optional[Union[int, urllib3.util.retry.Retry]] = None, ca_cert_data: Optional[Union[str, bytes]] = None, cert_file: Optional[str]=None, key_file: Optional[str]=None, @@ -554,7 +554,7 @@ def to_debug_report(self) -> str: "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: \n"\ - "SDK Package Version: 26.08.0".\ + "SDK Package Version: 26.09.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self) -> List[HostSetting]: diff --git a/talon_one/models/__init__.py b/talon_one/models/__init__.py index 62ce90f..965612a 100644 --- a/talon_one/models/__init__.py +++ b/talon_one/models/__init__.py @@ -124,6 +124,9 @@ from talon_one.models.campaign_detail import CampaignDetail from talon_one.models.campaign_edited_notification import CampaignEditedNotification from talon_one.models.campaign_edited_notification_item import CampaignEditedNotificationItem +from talon_one.models.campaign_eligibility import CampaignEligibility +from talon_one.models.campaign_eligibility_details import CampaignEligibilityDetails +from talon_one.models.campaign_eligibility_failure_details import CampaignEligibilityFailureDetails from talon_one.models.campaign_entity import CampaignEntity from talon_one.models.campaign_evaluation_group import CampaignEvaluationGroup from talon_one.models.campaign_evaluation_position import CampaignEvaluationPosition @@ -591,6 +594,8 @@ from talon_one.models.rollback_increased_achievement_progress_effect_props import RollbackIncreasedAchievementProgressEffectProps from talon_one.models.rollback_referral_effect_props import RollbackReferralEffectProps from talon_one.models.rule import Rule +from talon_one.models.rule_eligibility import RuleEligibility +from talon_one.models.rule_eligibility_failure_details import RuleEligibilityFailureDetails from talon_one.models.rule_failure_reason import RuleFailureReason from talon_one.models.rule_metadata import RuleMetadata from talon_one.models.ruleset import Ruleset @@ -697,6 +702,7 @@ from talon_one.models.update_price_type import UpdatePriceType from talon_one.models.update_referral import UpdateReferral from talon_one.models.update_referral_batch import UpdateReferralBatch +from talon_one.models.update_reward import UpdateReward from talon_one.models.update_role import UpdateRole from talon_one.models.update_store import UpdateStore from talon_one.models.update_user import UpdateUser diff --git a/talon_one/models/account_additional_cost.py b/talon_one/models/account_additional_cost.py index a06f2a8..f232cfc 100644 --- a/talon_one/models/account_additional_cost.py +++ b/talon_one/models/account_additional_cost.py @@ -42,6 +42,9 @@ class AccountAdditionalCost(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z]\w*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z]\w*$/") return value @@ -49,6 +52,9 @@ def name_validate_regular_expression(cls, value): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/talon_one/models/achievement.py b/talon_one/models/achievement.py index ba2f718..e550d8a 100644 --- a/talon_one/models/achievement.py +++ b/talon_one/models/achievement.py @@ -53,6 +53,9 @@ class Achievement(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/achievement_base.py b/talon_one/models/achievement_base.py index 1410747..d138067 100644 --- a/talon_one/models/achievement_base.py +++ b/talon_one/models/achievement_base.py @@ -49,6 +49,9 @@ def name_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/achievement_base_v2.py b/talon_one/models/achievement_base_v2.py index ff6d4a8..1964882 100644 --- a/talon_one/models/achievement_base_v2.py +++ b/talon_one/models/achievement_base_v2.py @@ -50,6 +50,9 @@ def name_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/achievement_progress_with_definition.py b/talon_one/models/achievement_progress_with_definition.py index caf618c..ca866a6 100644 --- a/talon_one/models/achievement_progress_with_definition.py +++ b/talon_one/models/achievement_progress_with_definition.py @@ -57,6 +57,9 @@ def status_validate_enum(cls, value): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/achievement_status_entry.py b/talon_one/models/achievement_status_entry.py index 125c011..e0499e7 100644 --- a/talon_one/models/achievement_status_entry.py +++ b/talon_one/models/achievement_status_entry.py @@ -52,6 +52,9 @@ class AchievementStatusEntry(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/achievement_v2.py b/talon_one/models/achievement_v2.py index 568b22b..a99c41f 100644 --- a/talon_one/models/achievement_v2.py +++ b/talon_one/models/achievement_v2.py @@ -53,6 +53,9 @@ class AchievementV2(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/add_loyalty_points_effect_props.py b/talon_one/models/add_loyalty_points_effect_props.py index 9efa160..8d261fb 100644 --- a/talon_one/models/add_loyalty_points_effect_props.py +++ b/talon_one/models/add_loyalty_points_effect_props.py @@ -53,6 +53,9 @@ def card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/attribute.py b/talon_one/models/attribute.py index f20c98d..7148fa9 100644 --- a/talon_one/models/attribute.py +++ b/talon_one/models/attribute.py @@ -58,6 +58,9 @@ def entity_validate_enum(cls, value): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z]\w*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z]\w*$/") return value @@ -65,6 +68,9 @@ def name_validate_regular_expression(cls, value): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/talon_one/models/audience.py b/talon_one/models/audience.py index 20ed9a3..58872df 100644 --- a/talon_one/models/audience.py +++ b/talon_one/models/audience.py @@ -35,11 +35,12 @@ class Audience(BaseModel): name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The human-friendly display name for this audience.") sandbox: Optional[StrictBool] = Field(default=None, description="Indicates if this is a live or sandbox Application.") description: Optional[StrictStr] = Field(default=None, description="A description of the audience.") + subscribed_applications_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of the IDs of the Applications that are connected to this audience.", alias="subscribedApplicationsIds") integration: Optional[StrictStr] = Field(default=None, description="The Talon.One-supported [3rd-party platform](https://docs.talon.one/docs/dev/technology-partners/overview) that this audience was created in. For example, `mParticle`, `Segment`, `Shopify`, `Braze`, or `Iterable`. **Note:** If you do not integrate with any of these platforms, do not use this property. ") integration_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="The ID of this audience in the third-party integration. **Note:** To create an audience that doesn't come from a 3rd party platform, do not use this property. ", alias="integrationId") created_in3rd_party: Optional[StrictBool] = Field(default=None, description="Determines if this audience is a 3rd party audience or not.", alias="createdIn3rdParty") last_update: Optional[datetime] = Field(default=None, description="The last time that the audience memberships changed.", alias="lastUpdate") - __properties: ClassVar[List[str]] = ["accountId", "id", "created", "name", "sandbox", "description", "integration", "integrationId", "createdIn3rdParty", "lastUpdate"] + __properties: ClassVar[List[str]] = ["accountId", "id", "created", "name", "sandbox", "description", "subscribedApplicationsIds", "integration", "integrationId", "createdIn3rdParty", "lastUpdate"] model_config = ConfigDict( validate_by_name=True, @@ -98,6 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "sandbox": obj.get("sandbox"), "description": obj.get("description"), + "subscribedApplicationsIds": obj.get("subscribedApplicationsIds"), "integration": obj.get("integration"), "integrationId": obj.get("integrationId"), "createdIn3rdParty": obj.get("createdIn3rdParty"), diff --git a/talon_one/models/campaign_collection.py b/talon_one/models/campaign_collection.py index 30fe012..5b4bc08 100644 --- a/talon_one/models/campaign_collection.py +++ b/talon_one/models/campaign_collection.py @@ -45,6 +45,9 @@ class CampaignCollection(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/campaign_collection_without_payload.py b/talon_one/models/campaign_collection_without_payload.py index 0b071da..279f411 100644 --- a/talon_one/models/campaign_collection_without_payload.py +++ b/talon_one/models/campaign_collection_without_payload.py @@ -44,6 +44,9 @@ class CampaignCollectionWithoutPayload(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/campaign_eligibility.py b/talon_one/models/campaign_eligibility.py new file mode 100644 index 0000000..11ba01c --- /dev/null +++ b/talon_one/models/campaign_eligibility.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from talon_one.models.campaign_eligibility_details import CampaignEligibilityDetails +from talon_one.models.rule_metadata import RuleMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CampaignEligibility(BaseModel): + """ + CampaignEligibility + """ # noqa: E501 + id: StrictInt = Field(description="Unique ID of Campaign.") + application_id: StrictInt = Field(description="The ID of the Application that owns this entity.", alias="applicationId") + name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The name of the campaign.") + description: Optional[StrictStr] = Field(default=None, description="A detailed description of the campaign.") + start_time: Optional[datetime] = Field(default=None, description="Timestamp when the campaign will become active.", alias="startTime") + end_time: Optional[datetime] = Field(default=None, description="Timestamp when the campaign will become inactive.", alias="endTime") + attributes: Optional[Dict[str, Any]] = Field(default=None, description="Arbitrary properties associated with this campaign.") + state: StrictStr = Field(description="The state of the campaign. ") + tags: Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=50)]], Field(max_length=50)] = Field(description="A list of tags for the campaign.") + features: List[StrictStr] = Field(description="The features enabled in this campaign.") + rules: Optional[List[RuleMetadata]] = Field(default=None, description="A list of rules containing customer-facing details of the rewards defined in the campaign.") + eligibility: List[CampaignEligibilityDetails] = Field(description="The customer's eligibility for each campaign in the current customer session.") + __properties: ClassVar[List[str]] = ["id", "applicationId", "name", "description", "startTime", "endTime", "attributes", "state", "tags", "features", "rules", "eligibility"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['enabled']): + raise ValueError("must be one of enum values ('enabled')") + return value + + @field_validator('features') + def features_validate_enum(cls, value): + """Validates the enum""" + for i in value: + if i not in set(['coupons', 'referrals', 'loyalty', 'giveaways', 'strikethrough', 'achievements']): + raise ValueError("each list item must be one of ('coupons', 'referrals', 'loyalty', 'giveaways', 'strikethrough', 'achievements')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignEligibility from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in rules (list) + _items = [] + if self.rules: + for _item_rules in self.rules: + if _item_rules: + _items.append(_item_rules.to_dict()) + _dict['rules'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in eligibility (list) + _items = [] + if self.eligibility: + for _item_eligibility in self.eligibility: + if _item_eligibility: + _items.append(_item_eligibility.to_dict()) + _dict['eligibility'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignEligibility from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "applicationId": obj.get("applicationId"), + "name": obj.get("name"), + "description": obj.get("description"), + "startTime": obj.get("startTime"), + "endTime": obj.get("endTime"), + "attributes": obj.get("attributes"), + "state": obj.get("state") if obj.get("state") is not None else 'enabled', + "tags": obj.get("tags"), + "features": obj.get("features"), + "rules": [RuleMetadata.from_dict(_item) for _item in obj["rules"]] if obj.get("rules") is not None else None, + "eligibility": [CampaignEligibilityDetails.from_dict(_item) for _item in obj["eligibility"]] if obj.get("eligibility") is not None else None + }) + return _obj + + diff --git a/talon_one/models/campaign_eligibility_details.py b/talon_one/models/campaign_eligibility_details.py new file mode 100644 index 0000000..72247f3 --- /dev/null +++ b/talon_one/models/campaign_eligibility_details.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from talon_one.models.campaign_eligibility_failure_details import CampaignEligibilityFailureDetails +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CampaignEligibilityDetails(BaseModel): + """ + CampaignEligibilityDetails + """ # noqa: E501 + passed: StrictBool = Field(description="Indicates whether the customer was eligible for the campaign in the current session.") + coupon_code: Optional[StrictStr] = Field(default=None, description="The coupon code used to check a customer's eligibility for the campaign in the current session, if applicable.", alias="couponCode") + details: Optional[CampaignEligibilityFailureDetails] = Field(default=None, description="The details about why the customer was not eligible for the campaign in the current session. Only returned when `passed` is `false`.") + __properties: ClassVar[List[str]] = ["passed", "couponCode", "details"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignEligibilityDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of details + if self.details: + _dict['details'] = self.details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignEligibilityDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "passed": obj.get("passed"), + "couponCode": obj.get("couponCode"), + "details": CampaignEligibilityFailureDetails.from_dict(obj["details"]) if obj.get("details") is not None else None + }) + return _obj + + diff --git a/talon_one/models/campaign_eligibility_failure_details.py b/talon_one/models/campaign_eligibility_failure_details.py new file mode 100644 index 0000000..e33d971 --- /dev/null +++ b/talon_one/models/campaign_eligibility_failure_details.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CampaignEligibilityFailureDetails(BaseModel): + """ + The details about why the customer was not eligible for the campaign in the current session. + """ # noqa: E501 + failure_code: StrictStr = Field(description="A code identifying why the customer was not eligible for the campaign.", alias="failureCode") + __properties: ClassVar[List[str]] = ["failureCode"] + + @field_validator('failure_code') + def failure_code_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ALL_RULES_FAILED', 'SKIPPED', 'AUDIENCE_NOT_MATCHED']): + raise ValueError("must be one of enum values ('ALL_RULES_FAILED', 'SKIPPED', 'AUDIENCE_NOT_MATCHED')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignEligibilityFailureDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignEligibilityFailureDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "failureCode": obj.get("failureCode") + }) + return _obj + + diff --git a/talon_one/models/campaign_template_collection.py b/talon_one/models/campaign_template_collection.py index d0f4439..ff5bb1b 100644 --- a/talon_one/models/campaign_template_collection.py +++ b/talon_one/models/campaign_template_collection.py @@ -35,6 +35,9 @@ class CampaignTemplateCollection(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z](\w|\s)*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z](\w|\s)*$/") return value diff --git a/talon_one/models/card_ledger_transaction_log_entry.py b/talon_one/models/card_ledger_transaction_log_entry.py index ecaa0d1..4674c32 100644 --- a/talon_one/models/card_ledger_transaction_log_entry.py +++ b/talon_one/models/card_ledger_transaction_log_entry.py @@ -48,6 +48,9 @@ class CardLedgerTransactionLogEntry(BaseModel): @field_validator('card_identifier') def card_identifier_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/card_ledger_transaction_log_entry_integration_api.py b/talon_one/models/card_ledger_transaction_log_entry_integration_api.py index 4a5338f..e81c41f 100644 --- a/talon_one/models/card_ledger_transaction_log_entry_integration_api.py +++ b/talon_one/models/card_ledger_transaction_log_entry_integration_api.py @@ -49,6 +49,9 @@ class CardLedgerTransactionLogEntryIntegrationAPI(BaseModel): @field_validator('card_identifier') def card_identifier_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/code_generator_settings.py b/talon_one/models/code_generator_settings.py index a0a538f..cdaf033 100644 --- a/talon_one/models/code_generator_settings.py +++ b/talon_one/models/code_generator_settings.py @@ -35,6 +35,9 @@ class CodeGeneratorSettings(BaseModel): @field_validator('coupon_pattern') def coupon_pattern_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@#-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@#-]+$/") return value diff --git a/talon_one/models/collection.py b/talon_one/models/collection.py index 951c34b..8df4429 100644 --- a/talon_one/models/collection.py +++ b/talon_one/models/collection.py @@ -46,6 +46,9 @@ class Collection(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/collection_without_payload.py b/talon_one/models/collection_without_payload.py index 5ada87a..fbe6e8c 100644 --- a/talon_one/models/collection_without_payload.py +++ b/talon_one/models/collection_without_payload.py @@ -45,6 +45,9 @@ class CollectionWithoutPayload(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/create_achievement.py b/talon_one/models/create_achievement.py index 0ffeb54..a2c8648 100644 --- a/talon_one/models/create_achievement.py +++ b/talon_one/models/create_achievement.py @@ -46,6 +46,9 @@ class CreateAchievement(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/create_achievement_v2.py b/talon_one/models/create_achievement_v2.py index 52cef22..d6fb17d 100644 --- a/talon_one/models/create_achievement_v2.py +++ b/talon_one/models/create_achievement_v2.py @@ -47,6 +47,9 @@ class CreateAchievementV2(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/custom_effect.py b/talon_one/models/custom_effect.py index 815564b..0dcc721 100644 --- a/talon_one/models/custom_effect.py +++ b/talon_one/models/custom_effect.py @@ -49,6 +49,9 @@ class CustomEffect(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z](\w|\s)*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z](\w|\s)*$/") return value @@ -56,6 +59,9 @@ def name_validate_regular_expression(cls, value): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/customer_profile_integration_request_v2.py b/talon_one/models/customer_profile_integration_request_v2.py index 2343727..31060f7 100644 --- a/talon_one/models/customer_profile_integration_request_v2.py +++ b/talon_one/models/customer_profile_integration_request_v2.py @@ -41,8 +41,8 @@ def response_content_validate_enum(cls, value): return value for i in value: - if i not in set(['customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons']): - raise ValueError("each list item must be one of ('customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons')") + if i not in set(['customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'campaignEligibility']): + raise ValueError("each list item must be one of ('customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'campaignEligibility')") return value model_config = ConfigDict( diff --git a/talon_one/models/customer_profile_integration_response_v2.py b/talon_one/models/customer_profile_integration_response_v2.py index f646ac4..9536a0d 100644 --- a/talon_one/models/customer_profile_integration_response_v2.py +++ b/talon_one/models/customer_profile_integration_response_v2.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional from talon_one.models.campaign import Campaign +from talon_one.models.campaign_eligibility import CampaignEligibility from talon_one.models.coupon import Coupon from talon_one.models.customer_profile import CustomerProfile from talon_one.models.effect import Effect @@ -41,11 +42,12 @@ class CustomerProfileIntegrationResponseV2(BaseModel): loyalty: Optional[Loyalty] = None triggered_campaigns: Optional[List[Campaign]] = Field(default=None, alias="triggeredCampaigns") rule_failure_reasons: Optional[List[RuleFailureReason]] = Field(default=None, alias="ruleFailureReasons") + campaign_eligibility: Optional[List[CampaignEligibility]] = Field(default=None, alias="campaignEligibility") awarded_giveaways: Optional[List[Giveaway]] = Field(default=None, alias="awardedGiveaways") effects: List[Effect] = Field(description="The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects).") created_coupons: List[Coupon] = Field(alias="createdCoupons") created_referrals: List[Referral] = Field(alias="createdReferrals") - __properties: ClassVar[List[str]] = ["customerProfile", "event", "loyalty", "triggeredCampaigns", "ruleFailureReasons", "awardedGiveaways", "effects", "createdCoupons", "createdReferrals"] + __properties: ClassVar[List[str]] = ["customerProfile", "event", "loyalty", "triggeredCampaigns", "ruleFailureReasons", "campaignEligibility", "awardedGiveaways", "effects", "createdCoupons", "createdReferrals"] model_config = ConfigDict( validate_by_name=True, @@ -109,6 +111,13 @@ def to_dict(self) -> Dict[str, Any]: if _item_rule_failure_reasons: _items.append(_item_rule_failure_reasons.to_dict()) _dict['ruleFailureReasons'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in campaign_eligibility (list) + _items = [] + if self.campaign_eligibility: + for _item_campaign_eligibility in self.campaign_eligibility: + if _item_campaign_eligibility: + _items.append(_item_campaign_eligibility.to_dict()) + _dict['campaignEligibility'] = _items # override the default output from pydantic by calling `to_dict()` of each item in awarded_giveaways (list) _items = [] if self.awarded_giveaways: @@ -154,6 +163,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "loyalty": Loyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, "triggeredCampaigns": [Campaign.from_dict(_item) for _item in obj["triggeredCampaigns"]] if obj.get("triggeredCampaigns") is not None else None, "ruleFailureReasons": [RuleFailureReason.from_dict(_item) for _item in obj["ruleFailureReasons"]] if obj.get("ruleFailureReasons") is not None else None, + "campaignEligibility": [CampaignEligibility.from_dict(_item) for _item in obj["campaignEligibility"]] if obj.get("campaignEligibility") is not None else None, "awardedGiveaways": [Giveaway.from_dict(_item) for _item in obj["awardedGiveaways"]] if obj.get("awardedGiveaways") is not None else None, "effects": [Effect.from_dict(_item) for _item in obj["effects"]] if obj.get("effects") is not None else None, "createdCoupons": [Coupon.from_dict(_item) for _item in obj["createdCoupons"]] if obj.get("createdCoupons") is not None else None, diff --git a/talon_one/models/deduct_loyalty_points_effect_props.py b/talon_one/models/deduct_loyalty_points_effect_props.py index 6e7846c..37991c9 100644 --- a/talon_one/models/deduct_loyalty_points_effect_props.py +++ b/talon_one/models/deduct_loyalty_points_effect_props.py @@ -43,6 +43,9 @@ def card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/generate_loyalty_card.py b/talon_one/models/generate_loyalty_card.py index db81ef3..89b260a 100644 --- a/talon_one/models/generate_loyalty_card.py +++ b/talon_one/models/generate_loyalty_card.py @@ -49,6 +49,9 @@ def card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/integration_campaign.py b/talon_one/models/integration_campaign.py index e018146..229580a 100644 --- a/talon_one/models/integration_campaign.py +++ b/talon_one/models/integration_campaign.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from talon_one.models.rule_metadata import RuleMetadata from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python @@ -31,7 +32,7 @@ class IntegrationCampaign(BaseModel): """ # noqa: E501 application_id: StrictInt = Field(description="The ID of the Application that owns this entity.", alias="applicationId") id: StrictInt = Field(description="Unique ID of Campaign.") - name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="A user-facing name for this campaign.") + name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The name of the campaign.") description: Optional[StrictStr] = Field(default=None, description="A detailed description of the campaign.") start_time: Optional[datetime] = Field(default=None, description="Timestamp when the campaign will become active.", alias="startTime") end_time: Optional[datetime] = Field(default=None, description="Timestamp when the campaign will become inactive.", alias="endTime") @@ -39,7 +40,8 @@ class IntegrationCampaign(BaseModel): state: StrictStr = Field(description="The state of the campaign. ") tags: Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=50)]], Field(max_length=50)] = Field(description="A list of tags for the campaign.") features: List[StrictStr] = Field(description="The features enabled in this campaign.") - __properties: ClassVar[List[str]] = ["applicationId", "id", "name", "description", "startTime", "endTime", "attributes", "state", "tags", "features"] + rules: Optional[List[RuleMetadata]] = Field(default=None, description="A list of rules containing customer-facing details of the rewards defined in the campaign.") + __properties: ClassVar[List[str]] = ["applicationId", "id", "name", "description", "startTime", "endTime", "attributes", "state", "tags", "features", "rules"] @field_validator('state') def state_validate_enum(cls, value): @@ -95,6 +97,13 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in rules (list) + _items = [] + if self.rules: + for _item_rules in self.rules: + if _item_rules: + _items.append(_item_rules.to_dict()) + _dict['rules'] = _items return _dict @classmethod @@ -116,7 +125,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "attributes": obj.get("attributes"), "state": obj.get("state") if obj.get("state") is not None else 'enabled', "tags": obj.get("tags"), - "features": obj.get("features") + "features": obj.get("features"), + "rules": [RuleMetadata.from_dict(_item) for _item in obj["rules"]] if obj.get("rules") is not None else None }) return _obj diff --git a/talon_one/models/integration_event_v2_request.py b/talon_one/models/integration_event_v2_request.py index f4697fe..fceef02 100644 --- a/talon_one/models/integration_event_v2_request.py +++ b/talon_one/models/integration_event_v2_request.py @@ -44,8 +44,8 @@ def response_content_validate_enum(cls, value): return value for i in value: - if i not in set(['customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons']): - raise ValueError("each list item must be one of ('customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons')") + if i not in set(['customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'campaignEligibility']): + raise ValueError("each list item must be one of ('customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'campaignEligibility')") return value model_config = ConfigDict( diff --git a/talon_one/models/integration_event_v2_response.py b/talon_one/models/integration_event_v2_response.py index 3d0dcbd..5fdf578 100644 --- a/talon_one/models/integration_event_v2_response.py +++ b/talon_one/models/integration_event_v2_response.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional from talon_one.models.campaign import Campaign +from talon_one.models.campaign_eligibility import CampaignEligibility from talon_one.models.coupon import Coupon from talon_one.models.customer_profile import CustomerProfile from talon_one.models.effect import Effect @@ -39,13 +40,14 @@ class IntegrationEventV2Response(BaseModel): customer_profile: Optional[CustomerProfile] = Field(default=None, description="The customer profile associated with the event.", alias="customerProfile") loyalty: Optional[Loyalty] = Field(default=None, description="The loyalty program status of the customer.") triggered_campaigns: Optional[List[Campaign]] = Field(default=None, description="The campaigns that were triggered as a result of processing the event.", alias="triggeredCampaigns") + campaign_eligibility: Optional[List[CampaignEligibility]] = Field(default=None, description="A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. ", alias="campaignEligibility") effects: List[Effect] = Field(description="The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects).") rule_failure_reasons: Optional[List[RuleFailureReason]] = Field(default=None, description="The reasons why certain rules were not triggered during the event processing. ", alias="ruleFailureReasons") created_coupons: List[Coupon] = Field(description="The coupons that were created during the event processing.", alias="createdCoupons") created_referrals: List[Referral] = Field(description="The referrals that were created during the event processing.", alias="createdReferrals") awarded_giveaways: Optional[List[Giveaway]] = Field(default=None, description="The giveaways that were awarded during the event processing.", alias="awardedGiveaways") event: Optional[Event] = Field(default=None, description="The event that was processed.") - __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways", "event"] + __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "campaignEligibility", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways", "event"] model_config = ConfigDict( validate_by_name=True, @@ -99,6 +101,13 @@ def to_dict(self) -> Dict[str, Any]: if _item_triggered_campaigns: _items.append(_item_triggered_campaigns.to_dict()) _dict['triggeredCampaigns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in campaign_eligibility (list) + _items = [] + if self.campaign_eligibility: + for _item_campaign_eligibility in self.campaign_eligibility: + if _item_campaign_eligibility: + _items.append(_item_campaign_eligibility.to_dict()) + _dict['campaignEligibility'] = _items # override the default output from pydantic by calling `to_dict()` of each item in effects (list) _items = [] if self.effects: @@ -152,6 +161,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "customerProfile": CustomerProfile.from_dict(obj["customerProfile"]) if obj.get("customerProfile") is not None else None, "loyalty": Loyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, "triggeredCampaigns": [Campaign.from_dict(_item) for _item in obj["triggeredCampaigns"]] if obj.get("triggeredCampaigns") is not None else None, + "campaignEligibility": [CampaignEligibility.from_dict(_item) for _item in obj["campaignEligibility"]] if obj.get("campaignEligibility") is not None else None, "effects": [Effect.from_dict(_item) for _item in obj["effects"]] if obj.get("effects") is not None else None, "ruleFailureReasons": [RuleFailureReason.from_dict(_item) for _item in obj["ruleFailureReasons"]] if obj.get("ruleFailureReasons") is not None else None, "createdCoupons": [Coupon.from_dict(_item) for _item in obj["createdCoupons"]] if obj.get("createdCoupons") is not None else None, diff --git a/talon_one/models/integration_event_v3_response.py b/talon_one/models/integration_event_v3_response.py index cb24b55..ecb5ab5 100644 --- a/talon_one/models/integration_event_v3_response.py +++ b/talon_one/models/integration_event_v3_response.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional from talon_one.models.campaign import Campaign +from talon_one.models.campaign_eligibility import CampaignEligibility from talon_one.models.coupon import Coupon from talon_one.models.customer_profile import CustomerProfile from talon_one.models.effect import Effect @@ -39,13 +40,14 @@ class IntegrationEventV3Response(BaseModel): customer_profile: Optional[CustomerProfile] = Field(default=None, description="The customer profile associated with the event.", alias="customerProfile") loyalty: Optional[Loyalty] = Field(default=None, description="The loyalty program status of the customer.") triggered_campaigns: Optional[List[Campaign]] = Field(default=None, description="The campaigns that were triggered as a result of processing the event.", alias="triggeredCampaigns") + campaign_eligibility: Optional[List[CampaignEligibility]] = Field(default=None, description="A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. ", alias="campaignEligibility") effects: List[Effect] = Field(description="The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects).") rule_failure_reasons: Optional[List[RuleFailureReason]] = Field(default=None, description="The reasons why certain rules were not triggered during the event processing. ", alias="ruleFailureReasons") created_coupons: List[Coupon] = Field(description="The coupons that were created during the event processing.", alias="createdCoupons") created_referrals: List[Referral] = Field(description="The referrals that were created during the event processing.", alias="createdReferrals") awarded_giveaways: Optional[List[Giveaway]] = Field(default=None, description="The giveaways that were awarded during the event processing.", alias="awardedGiveaways") advanced_event: Optional[EventV3] = Field(default=None, description="The advanced event that was processed.", alias="advancedEvent") - __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways", "advancedEvent"] + __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "campaignEligibility", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways", "advancedEvent"] model_config = ConfigDict( validate_by_name=True, @@ -99,6 +101,13 @@ def to_dict(self) -> Dict[str, Any]: if _item_triggered_campaigns: _items.append(_item_triggered_campaigns.to_dict()) _dict['triggeredCampaigns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in campaign_eligibility (list) + _items = [] + if self.campaign_eligibility: + for _item_campaign_eligibility in self.campaign_eligibility: + if _item_campaign_eligibility: + _items.append(_item_campaign_eligibility.to_dict()) + _dict['campaignEligibility'] = _items # override the default output from pydantic by calling `to_dict()` of each item in effects (list) _items = [] if self.effects: @@ -152,6 +161,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "customerProfile": CustomerProfile.from_dict(obj["customerProfile"]) if obj.get("customerProfile") is not None else None, "loyalty": Loyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, "triggeredCampaigns": [Campaign.from_dict(_item) for _item in obj["triggeredCampaigns"]] if obj.get("triggeredCampaigns") is not None else None, + "campaignEligibility": [CampaignEligibility.from_dict(_item) for _item in obj["campaignEligibility"]] if obj.get("campaignEligibility") is not None else None, "effects": [Effect.from_dict(_item) for _item in obj["effects"]] if obj.get("effects") is not None else None, "ruleFailureReasons": [RuleFailureReason.from_dict(_item) for _item in obj["ruleFailureReasons"]] if obj.get("ruleFailureReasons") is not None else None, "createdCoupons": [Coupon.from_dict(_item) for _item in obj["createdCoupons"]] if obj.get("createdCoupons") is not None else None, diff --git a/talon_one/models/integration_request.py b/talon_one/models/integration_request.py index 7f4ec82..95f10d5 100644 --- a/talon_one/models/integration_request.py +++ b/talon_one/models/integration_request.py @@ -39,8 +39,8 @@ def response_content_validate_enum(cls, value): return value for i in value: - if i not in set(['customerSession', 'customerProfile', 'coupons', 'triggeredCampaigns', 'referral', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'previousReturns']): - raise ValueError("each list item must be one of ('customerSession', 'customerProfile', 'coupons', 'triggeredCampaigns', 'referral', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'previousReturns')") + if i not in set(['customerSession', 'customerProfile', 'coupons', 'triggeredCampaigns', 'referral', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'previousReturns', 'campaignEligibility']): + raise ValueError("each list item must be one of ('customerSession', 'customerProfile', 'coupons', 'triggeredCampaigns', 'referral', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'previousReturns', 'campaignEligibility')") return value model_config = ConfigDict( diff --git a/talon_one/models/integration_response.py b/talon_one/models/integration_response.py index b36fe6a..568bf7c 100644 --- a/talon_one/models/integration_response.py +++ b/talon_one/models/integration_response.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional from talon_one.models.campaign import Campaign +from talon_one.models.campaign_eligibility import CampaignEligibility from talon_one.models.coupon import Coupon from talon_one.models.customer_profile import CustomerProfile from talon_one.models.effect import Effect @@ -38,12 +39,13 @@ class IntegrationResponse(BaseModel): customer_profile: Optional[CustomerProfile] = Field(default=None, description="The customer profile associated with the event.", alias="customerProfile") loyalty: Optional[Loyalty] = Field(default=None, description="The loyalty program status of the customer.") triggered_campaigns: Optional[List[Campaign]] = Field(default=None, description="The campaigns that were triggered as a result of processing the event.", alias="triggeredCampaigns") + campaign_eligibility: Optional[List[CampaignEligibility]] = Field(default=None, description="A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. ", alias="campaignEligibility") effects: List[Effect] = Field(description="The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects).") rule_failure_reasons: Optional[List[RuleFailureReason]] = Field(default=None, description="The reasons why certain rules were not triggered during the event processing. ", alias="ruleFailureReasons") created_coupons: List[Coupon] = Field(description="The coupons that were created during the event processing.", alias="createdCoupons") created_referrals: List[Referral] = Field(description="The referrals that were created during the event processing.", alias="createdReferrals") awarded_giveaways: Optional[List[Giveaway]] = Field(default=None, description="The giveaways that were awarded during the event processing.", alias="awardedGiveaways") - __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways"] + __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "campaignEligibility", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways"] model_config = ConfigDict( validate_by_name=True, @@ -97,6 +99,13 @@ def to_dict(self) -> Dict[str, Any]: if _item_triggered_campaigns: _items.append(_item_triggered_campaigns.to_dict()) _dict['triggeredCampaigns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in campaign_eligibility (list) + _items = [] + if self.campaign_eligibility: + for _item_campaign_eligibility in self.campaign_eligibility: + if _item_campaign_eligibility: + _items.append(_item_campaign_eligibility.to_dict()) + _dict['campaignEligibility'] = _items # override the default output from pydantic by calling `to_dict()` of each item in effects (list) _items = [] if self.effects: @@ -147,6 +156,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "customerProfile": CustomerProfile.from_dict(obj["customerProfile"]) if obj.get("customerProfile") is not None else None, "loyalty": Loyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, "triggeredCampaigns": [Campaign.from_dict(_item) for _item in obj["triggeredCampaigns"]] if obj.get("triggeredCampaigns") is not None else None, + "campaignEligibility": [CampaignEligibility.from_dict(_item) for _item in obj["campaignEligibility"]] if obj.get("campaignEligibility") is not None else None, "effects": [Effect.from_dict(_item) for _item in obj["effects"]] if obj.get("effects") is not None else None, "ruleFailureReasons": [RuleFailureReason.from_dict(_item) for _item in obj["ruleFailureReasons"]] if obj.get("ruleFailureReasons") is not None else None, "createdCoupons": [Coupon.from_dict(_item) for _item in obj["createdCoupons"]] if obj.get("createdCoupons") is not None else None, diff --git a/talon_one/models/integration_state_v2.py b/talon_one/models/integration_state_v2.py index 5d61de5..1579f79 100644 --- a/talon_one/models/integration_state_v2.py +++ b/talon_one/models/integration_state_v2.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional from talon_one.models.campaign import Campaign +from talon_one.models.campaign_eligibility import CampaignEligibility from talon_one.models.coupon import Coupon from talon_one.models.customer_profile import CustomerProfile from talon_one.models.customer_session_v2 import CustomerSessionV2 @@ -44,6 +45,7 @@ class IntegrationStateV2(BaseModel): customer_profile: Optional[CustomerProfile] = Field(default=None, description="The customer profile associated with the event.", alias="customerProfile") loyalty: Optional[Loyalty] = Field(default=None, description="The loyalty program status of the customer.") triggered_campaigns: Optional[List[Campaign]] = Field(default=None, description="The campaigns that were triggered as a result of processing the event.", alias="triggeredCampaigns") + campaign_eligibility: Optional[List[CampaignEligibility]] = Field(default=None, description="A list of campaigns and their evaluation status for the current customer session. **Note**: - This response can **only** be included if the `dry` parameter in the query is set to `true`. - Do not include `triggeredCampaigns` or `ruleFailureReasons` in `responseContent` to avoid duplicate results. ", alias="campaignEligibility") effects: List[Effect] = Field(description="The effects generated by the rules in your running campaigns. See [API effects](https://docs.talon.one/docs/dev/integration-api/api-effects).") rule_failure_reasons: Optional[List[RuleFailureReason]] = Field(default=None, description="The reasons why certain rules were not triggered during the event processing. ", alias="ruleFailureReasons") created_coupons: List[Coupon] = Field(description="The coupons that were created during the event processing.", alias="createdCoupons") @@ -56,7 +58,7 @@ class IntegrationStateV2(BaseModel): customer_session: Optional[CustomerSessionV2] = Field(default=None, description="The session that was processed.", alias="customerSession") var_return: Optional[ModelReturn] = Field(default=None, description="The return that was processed.", alias="return") previous_returns: Optional[List[ModelReturn]] = Field(default=None, description="The previous returns associated with the event.", alias="previousReturns") - __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways", "referral", "coupons", "event", "advancedEvent", "customerSession", "return", "previousReturns"] + __properties: ClassVar[List[str]] = ["customerProfile", "loyalty", "triggeredCampaigns", "campaignEligibility", "effects", "ruleFailureReasons", "createdCoupons", "createdReferrals", "awardedGiveaways", "referral", "coupons", "event", "advancedEvent", "customerSession", "return", "previousReturns"] model_config = ConfigDict( validate_by_name=True, @@ -110,6 +112,13 @@ def to_dict(self) -> Dict[str, Any]: if _item_triggered_campaigns: _items.append(_item_triggered_campaigns.to_dict()) _dict['triggeredCampaigns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in campaign_eligibility (list) + _items = [] + if self.campaign_eligibility: + for _item_campaign_eligibility in self.campaign_eligibility: + if _item_campaign_eligibility: + _items.append(_item_campaign_eligibility.to_dict()) + _dict['campaignEligibility'] = _items # override the default output from pydantic by calling `to_dict()` of each item in effects (list) _items = [] if self.effects: @@ -189,6 +198,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "customerProfile": CustomerProfile.from_dict(obj["customerProfile"]) if obj.get("customerProfile") is not None else None, "loyalty": Loyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, "triggeredCampaigns": [Campaign.from_dict(_item) for _item in obj["triggeredCampaigns"]] if obj.get("triggeredCampaigns") is not None else None, + "campaignEligibility": [CampaignEligibility.from_dict(_item) for _item in obj["campaignEligibility"]] if obj.get("campaignEligibility") is not None else None, "effects": [Effect.from_dict(_item) for _item in obj["effects"]] if obj.get("effects") is not None else None, "ruleFailureReasons": [RuleFailureReason.from_dict(_item) for _item in obj["ruleFailureReasons"]] if obj.get("ruleFailureReasons") is not None else None, "createdCoupons": [Coupon.from_dict(_item) for _item in obj["createdCoupons"]] if obj.get("createdCoupons") is not None else None, diff --git a/talon_one/models/loyalty_card.py b/talon_one/models/loyalty_card.py index 33d3b81..683d24f 100644 --- a/talon_one/models/loyalty_card.py +++ b/talon_one/models/loyalty_card.py @@ -52,6 +52,9 @@ class LoyaltyCard(BaseModel): @field_validator('identifier') def identifier_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value @@ -62,6 +65,9 @@ def old_card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value @@ -72,6 +78,9 @@ def new_card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/loyalty_card_batch.py b/talon_one/models/loyalty_card_batch.py index 1d008de..dd55061 100644 --- a/talon_one/models/loyalty_card_batch.py +++ b/talon_one/models/loyalty_card_batch.py @@ -41,6 +41,9 @@ def batch_id_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9_-]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9_-]*$/") return value diff --git a/talon_one/models/loyalty_program_transaction.py b/talon_one/models/loyalty_program_transaction.py index c606a2e..55cf3d2 100644 --- a/talon_one/models/loyalty_program_transaction.py +++ b/talon_one/models/loyalty_program_transaction.py @@ -66,6 +66,9 @@ def card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/multiple_audiences_item.py b/talon_one/models/multiple_audiences_item.py index 34257da..456c955 100644 --- a/talon_one/models/multiple_audiences_item.py +++ b/talon_one/models/multiple_audiences_item.py @@ -32,9 +32,10 @@ class MultipleAudiencesItem(BaseModel): id: StrictInt = Field(description="The internal ID of this entity.") created: datetime = Field(description="The time this entity was created.") name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The human-friendly display name for this audience.") + subscribed_applications_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of the IDs of the Applications that are connected to this audience.", alias="subscribedApplicationsIds") integration_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="The ID of this audience in the third-party integration.", alias="integrationId") status: StrictStr = Field(description="Indicates whether the audience is new, updated or unmodified by the request. ") - __properties: ClassVar[List[str]] = ["id", "created", "name", "integrationId", "status"] + __properties: ClassVar[List[str]] = ["id", "created", "name", "subscribedApplicationsIds", "integrationId", "status"] @field_validator('status') def status_validate_enum(cls, value): @@ -97,6 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "id": obj.get("id"), "created": obj.get("created"), "name": obj.get("name"), + "subscribedApplicationsIds": obj.get("subscribedApplicationsIds"), "integrationId": obj.get("integrationId"), "status": obj.get("status") }) diff --git a/talon_one/models/new_additional_cost.py b/talon_one/models/new_additional_cost.py index f9b7860..7c9739f 100644 --- a/talon_one/models/new_additional_cost.py +++ b/talon_one/models/new_additional_cost.py @@ -38,6 +38,9 @@ class NewAdditionalCost(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z]\w*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z]\w*$/") return value @@ -45,6 +48,9 @@ def name_validate_regular_expression(cls, value): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/talon_one/models/new_application.py b/talon_one/models/new_application.py index 4fef8b5..42c6498 100644 --- a/talon_one/models/new_application.py +++ b/talon_one/models/new_application.py @@ -84,6 +84,9 @@ def key_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-fA-F0-9]{16}$", value): raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{16}$/") return value diff --git a/talon_one/models/new_attribute.py b/talon_one/models/new_attribute.py index 2ce87b7..828ba91 100644 --- a/talon_one/models/new_attribute.py +++ b/talon_one/models/new_attribute.py @@ -53,6 +53,9 @@ def entity_validate_enum(cls, value): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z]\w*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z]\w*$/") return value @@ -60,6 +63,9 @@ def name_validate_regular_expression(cls, value): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/talon_one/models/new_audience.py b/talon_one/models/new_audience.py index 34cf533..3b53035 100644 --- a/talon_one/models/new_audience.py +++ b/talon_one/models/new_audience.py @@ -18,7 +18,7 @@ import json from datetime import datetime -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from typing import Optional, Set @@ -32,11 +32,12 @@ class NewAudience(BaseModel): name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The human-friendly display name for this audience.") sandbox: Optional[StrictBool] = Field(default=None, description="Indicates if this is a live or sandbox Application.") description: Optional[StrictStr] = Field(default=None, description="A description of the audience.") + subscribed_applications_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of the IDs of the Applications that are connected to this audience.", alias="subscribedApplicationsIds") integration: Optional[StrictStr] = Field(default=None, description="The Talon.One-supported [3rd-party platform](https://docs.talon.one/docs/dev/technology-partners/overview) that this audience was created in. For example, `mParticle`, `Segment`, `Shopify`, `Braze`, or `Iterable`. **Note:** If you do not integrate with any of these platforms, do not use this property. ") integration_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="The ID of this audience in the third-party integration. **Note:** To create an audience that doesn't come from a 3rd party platform, do not use this property. ", alias="integrationId") created_in3rd_party: Optional[StrictBool] = Field(default=None, description="Determines if this audience is a 3rd party audience or not.", alias="createdIn3rdParty") last_update: Optional[datetime] = Field(default=None, description="The last time that the audience memberships changed.", alias="lastUpdate") - __properties: ClassVar[List[str]] = ["name", "sandbox", "description", "integration", "integrationId", "createdIn3rdParty", "lastUpdate"] + __properties: ClassVar[List[str]] = ["name", "sandbox", "description", "subscribedApplicationsIds", "integration", "integrationId", "createdIn3rdParty", "lastUpdate"] model_config = ConfigDict( validate_by_name=True, @@ -92,6 +93,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "sandbox": obj.get("sandbox"), "description": obj.get("description"), + "subscribedApplicationsIds": obj.get("subscribedApplicationsIds"), "integration": obj.get("integration"), "integrationId": obj.get("integrationId"), "createdIn3rdParty": obj.get("createdIn3rdParty"), diff --git a/talon_one/models/new_campaign_collection.py b/talon_one/models/new_campaign_collection.py index 622b704..627b16b 100644 --- a/talon_one/models/new_campaign_collection.py +++ b/talon_one/models/new_campaign_collection.py @@ -35,6 +35,9 @@ class NewCampaignCollection(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/new_collection.py b/talon_one/models/new_collection.py index 319ab7f..02a4578 100644 --- a/talon_one/models/new_collection.py +++ b/talon_one/models/new_collection.py @@ -36,6 +36,9 @@ class NewCollection(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/new_custom_effect.py b/talon_one/models/new_custom_effect.py index afa6623..63298b8 100644 --- a/talon_one/models/new_custom_effect.py +++ b/talon_one/models/new_custom_effect.py @@ -42,6 +42,9 @@ class NewCustomEffect(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z](\w|\s)*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z](\w|\s)*$/") return value @@ -49,6 +52,9 @@ def name_validate_regular_expression(cls, value): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/new_internal_audience.py b/talon_one/models/new_internal_audience.py index 52942cc..46734b9 100644 --- a/talon_one/models/new_internal_audience.py +++ b/talon_one/models/new_internal_audience.py @@ -17,7 +17,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from typing import Optional, Set @@ -31,7 +31,8 @@ class NewInternalAudience(BaseModel): name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The human-friendly display name for this audience.") sandbox: Optional[StrictBool] = Field(default=None, description="Indicates if this is a live or sandbox Application.") description: Optional[StrictStr] = Field(default=None, description="A description of the audience.") - __properties: ClassVar[List[str]] = ["name", "sandbox", "description"] + subscribed_applications_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of the IDs of the Applications that are connected to this audience.", alias="subscribedApplicationsIds") + __properties: ClassVar[List[str]] = ["name", "sandbox", "description", "subscribedApplicationsIds"] model_config = ConfigDict( validate_by_name=True, @@ -86,7 +87,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "name": obj.get("name"), "sandbox": obj.get("sandbox"), - "description": obj.get("description") + "description": obj.get("description"), + "subscribedApplicationsIds": obj.get("subscribedApplicationsIds") }) return _obj diff --git a/talon_one/models/new_multiple_audiences_item.py b/talon_one/models/new_multiple_audiences_item.py index 7245165..e31c4a3 100644 --- a/talon_one/models/new_multiple_audiences_item.py +++ b/talon_one/models/new_multiple_audiences_item.py @@ -17,7 +17,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, StrictInt from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from typing import Optional, Set @@ -29,8 +29,9 @@ class NewMultipleAudiencesItem(BaseModel): NewMultipleAudiencesItem """ # noqa: E501 name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The human-friendly display name for this audience.") + subscribed_applications_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of the IDs of the Applications that are connected to this audience.", alias="subscribedApplicationsIds") integration_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=1000)]] = Field(default=None, description="The ID of this audience in the third-party integration.", alias="integrationId") - __properties: ClassVar[List[str]] = ["name", "integrationId"] + __properties: ClassVar[List[str]] = ["name", "subscribedApplicationsIds", "integrationId"] model_config = ConfigDict( validate_by_name=True, @@ -84,6 +85,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "name": obj.get("name"), + "subscribedApplicationsIds": obj.get("subscribedApplicationsIds"), "integrationId": obj.get("integrationId") }) return _obj diff --git a/talon_one/models/new_price_type.py b/talon_one/models/new_price_type.py index 4564fa8..df34c70 100644 --- a/talon_one/models/new_price_type.py +++ b/talon_one/models/new_price_type.py @@ -37,6 +37,9 @@ class NewPriceType(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z]\w*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z]\w*$/") return value diff --git a/talon_one/models/new_reward.py b/talon_one/models/new_reward.py index 5f8597e..99cfe74 100644 --- a/talon_one/models/new_reward.py +++ b/talon_one/models/new_reward.py @@ -20,6 +20,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from talon_one.models.binding import Binding +from talon_one.models.rule import Rule from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python @@ -33,7 +35,9 @@ class NewReward(BaseModel): description: Optional[StrictStr] = Field(default=None, description="A description of the reward.") application_ids: List[StrictInt] = Field(description="The IDs of the Applications this reward is connected to. **Note**: Currently, a reward can only be connected to one Application. ", alias="applicationIds") sandbox: StrictBool = Field(description="Indicates if this is a live or sandbox reward. Rewards of a given type can only be connected to Applications of the same type.") - __properties: ClassVar[List[str]] = ["name", "apiName", "description", "applicationIds", "sandbox"] + rule: Optional[List[Rule]] = Field(default=None, description="Rule to apply.") + bindings: Optional[List[Binding]] = Field(default=None, description="A list of named variables created before the reward's rules are evaluated. Each binding pairs a name with a talang expression. The expression is evaluated once and its result is available by name in any rule condition or effect. Bindings must be defined outside of individual rules.") + __properties: ClassVar[List[str]] = ["name", "apiName", "description", "applicationIds", "sandbox", "rule", "bindings"] model_config = ConfigDict( validate_by_name=True, @@ -74,6 +78,20 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in rule (list) + _items = [] + if self.rule: + for _item_rule in self.rule: + if _item_rule: + _items.append(_item_rule.to_dict()) + _dict['rule'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in bindings (list) + _items = [] + if self.bindings: + for _item_bindings in self.bindings: + if _item_bindings: + _items.append(_item_bindings.to_dict()) + _dict['bindings'] = _items return _dict @classmethod @@ -90,7 +108,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "apiName": obj.get("apiName"), "description": obj.get("description"), "applicationIds": obj.get("applicationIds"), - "sandbox": obj.get("sandbox") + "sandbox": obj.get("sandbox"), + "rule": [Rule.from_dict(_item) for _item in obj["rule"]] if obj.get("rule") is not None else None, + "bindings": [Binding.from_dict(_item) for _item in obj["bindings"]] if obj.get("bindings") is not None else None }) return _obj diff --git a/talon_one/models/new_secondary_deployment.py b/talon_one/models/new_secondary_deployment.py index afc6ae3..4d1a87b 100644 --- a/talon_one/models/new_secondary_deployment.py +++ b/talon_one/models/new_secondary_deployment.py @@ -34,6 +34,9 @@ class NewSecondaryDeployment(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-z0-9]+$", value): raise ValueError(r"must validate the regular expression /^[a-z0-9]+$/") return value diff --git a/talon_one/models/new_webhook.py b/talon_one/models/new_webhook.py index 6852b84..359f985 100644 --- a/talon_one/models/new_webhook.py +++ b/talon_one/models/new_webhook.py @@ -45,6 +45,9 @@ class NewWebhook(BaseModel): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/talon_one/models/price_type.py b/talon_one/models/price_type.py index 8449290..5e74f7e 100644 --- a/talon_one/models/price_type.py +++ b/talon_one/models/price_type.py @@ -43,6 +43,9 @@ class PriceType(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z]\w*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z]\w*$/") return value diff --git a/talon_one/models/response_content_object.py b/talon_one/models/response_content_object.py index 37d1a47..6bc8f4d 100644 --- a/talon_one/models/response_content_object.py +++ b/talon_one/models/response_content_object.py @@ -37,8 +37,8 @@ def response_content_validate_enum(cls, value): return value for i in value: - if i not in set(['customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons']): - raise ValueError("each list item must be one of ('customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons')") + if i not in set(['customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'campaignEligibility']): + raise ValueError("each list item must be one of ('customerProfile', 'triggeredCampaigns', 'loyalty', 'event', 'awardedGiveaways', 'ruleFailureReasons', 'campaignEligibility')") return value model_config = ConfigDict( diff --git a/talon_one/models/reward.py b/talon_one/models/reward.py index 7976ef4..2c25a62 100644 --- a/talon_one/models/reward.py +++ b/talon_one/models/reward.py @@ -21,6 +21,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from talon_one.models.binding import Binding +from talon_one.models.rule import Rule from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python @@ -37,8 +39,10 @@ class Reward(BaseModel): description: Optional[StrictStr] = Field(default=None, description="A description of the reward.") application_ids: List[StrictInt] = Field(description="The IDs of the Applications this reward is connected to. **Note**: Currently, a reward can only be connected to one Application. ", alias="applicationIds") sandbox: StrictBool = Field(description="Indicates if this is a live or sandbox reward. Rewards of a given type can only be connected to Applications of the same type.") + rule: Optional[List[Rule]] = Field(default=None, description="Rule to apply.") + bindings: Optional[List[Binding]] = Field(default=None, description="A list of named variables created before the reward's rules are evaluated. Each binding pairs a name with a talang expression. The expression is evaluated once and its result is available by name in any rule condition or effect. Bindings must be defined outside of individual rules.") status: StrictStr = Field(description="The status of the reward.") - __properties: ClassVar[List[str]] = ["id", "created", "accountId", "name", "apiName", "description", "applicationIds", "sandbox", "status"] + __properties: ClassVar[List[str]] = ["id", "created", "accountId", "name", "apiName", "description", "applicationIds", "sandbox", "rule", "bindings", "status"] @field_validator('status') def status_validate_enum(cls, value): @@ -86,6 +90,20 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in rule (list) + _items = [] + if self.rule: + for _item_rule in self.rule: + if _item_rule: + _items.append(_item_rule.to_dict()) + _dict['rule'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in bindings (list) + _items = [] + if self.bindings: + for _item_bindings in self.bindings: + if _item_bindings: + _items.append(_item_bindings.to_dict()) + _dict['bindings'] = _items return _dict @classmethod @@ -106,6 +124,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "description": obj.get("description"), "applicationIds": obj.get("applicationIds"), "sandbox": obj.get("sandbox"), + "rule": [Rule.from_dict(_item) for _item in obj["rule"]] if obj.get("rule") is not None else None, + "bindings": [Binding.from_dict(_item) for _item in obj["bindings"]] if obj.get("bindings") is not None else None, "status": obj.get("status") }) return _obj diff --git a/talon_one/models/rollback_added_loyalty_points_effect_props.py b/talon_one/models/rollback_added_loyalty_points_effect_props.py index 5516890..c1837d9 100644 --- a/talon_one/models/rollback_added_loyalty_points_effect_props.py +++ b/talon_one/models/rollback_added_loyalty_points_effect_props.py @@ -44,6 +44,9 @@ def card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/rollback_deducted_loyalty_points_effect_props.py b/talon_one/models/rollback_deducted_loyalty_points_effect_props.py index 3f664e5..648222a 100644 --- a/talon_one/models/rollback_deducted_loyalty_points_effect_props.py +++ b/talon_one/models/rollback_deducted_loyalty_points_effect_props.py @@ -45,6 +45,9 @@ def card_identifier_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/rule_eligibility.py b/talon_one/models/rule_eligibility.py new file mode 100644 index 0000000..b75c73b --- /dev/null +++ b/talon_one/models/rule_eligibility.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from talon_one.models.rule_eligibility_failure_details import RuleEligibilityFailureDetails +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RuleEligibility(BaseModel): + """ + The customer's eligibility for a rule in the current session, based on whether all of the rule's conditions were met. + """ # noqa: E501 + passed: StrictBool = Field(description="Indicates whether the customer was eligible for the rule in the current session, based on whether all of the rule's conditions were met.") + coupon_code: Optional[StrictStr] = Field(default=None, description="The coupon code used to check a customer's eligibility for the rule in the current session, if applicable.", alias="couponCode") + details: Optional[RuleEligibilityFailureDetails] = Field(default=None, description="The details about why the customer was not eligible for the rule in the current session. Only returned when `passed` is `false`.") + __properties: ClassVar[List[str]] = ["passed", "couponCode", "details"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RuleEligibility from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of details + if self.details: + _dict['details'] = self.details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RuleEligibility from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "passed": obj.get("passed"), + "couponCode": obj.get("couponCode"), + "details": RuleEligibilityFailureDetails.from_dict(obj["details"]) if obj.get("details") is not None else None + }) + return _obj + + diff --git a/talon_one/models/rule_eligibility_failure_details.py b/talon_one/models/rule_eligibility_failure_details.py new file mode 100644 index 0000000..d4f024e --- /dev/null +++ b/talon_one/models/rule_eligibility_failure_details.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RuleEligibilityFailureDetails(BaseModel): + """ + The details about why the customer was not eligible for the rule in the current session. + """ # noqa: E501 + failure_code: StrictStr = Field(description="A code identifying why the customer was not eligible for the rule in the current session.", alias="failureCode") + coupon_id: Optional[StrictInt] = Field(default=None, description="The ID of the coupon that was being evaluated when the rule failed. ", alias="couponID") + coupon_value: Optional[StrictStr] = Field(default=None, description="The coupon code that was being evaluated when the rule failed. ", alias="couponValue") + referral_id: Optional[StrictInt] = Field(default=None, description="The ID of the referral that was being evaluated when the rule failed. ", alias="referralID") + referral_value: Optional[StrictStr] = Field(default=None, description="The referral code that was being evaluated when the rule failed. ", alias="referralValue") + condition_index: Optional[StrictInt] = Field(default=None, description="The index of the condition that caused the rule to fail.", alias="conditionIndex") + effect_index: Optional[StrictInt] = Field(default=None, description="The index of the effect that caused the rule to fail.", alias="effectIndex") + details: StrictStr = Field(description="Additional details about the failure.") + __properties: ClassVar[List[str]] = ["failureCode", "couponID", "couponValue", "referralID", "referralValue", "conditionIndex", "effectIndex", "details"] + + @field_validator('failure_code') + def failure_code_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['CONDITION_NOT_MET', 'EFFECT_FAILED']): + raise ValueError("must be one of enum values ('CONDITION_NOT_MET', 'EFFECT_FAILED')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RuleEligibilityFailureDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RuleEligibilityFailureDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "failureCode": obj.get("failureCode"), + "couponID": obj.get("couponID"), + "couponValue": obj.get("couponValue"), + "referralID": obj.get("referralID"), + "referralValue": obj.get("referralValue"), + "conditionIndex": obj.get("conditionIndex"), + "effectIndex": obj.get("effectIndex"), + "details": obj.get("details") + }) + return _obj + + diff --git a/talon_one/models/rule_metadata.py b/talon_one/models/rule_metadata.py index eced4fe..a37764b 100644 --- a/talon_one/models/rule_metadata.py +++ b/talon_one/models/rule_metadata.py @@ -19,6 +19,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from talon_one.models.rule_eligibility import RuleEligibility from typing import Optional, Set from typing_extensions import Self from pydantic_core import to_jsonable_python @@ -31,7 +32,8 @@ class RuleMetadata(BaseModel): display_name: Optional[StrictStr] = Field(default=None, description="A customer-facing name for the rule.", alias="displayName") display_description: Optional[StrictStr] = Field(default=None, description="A customer-facing description that explains the details of the rule. For example, this property can contain details about eligibility requirements, reward timelines, or terms and conditions. ", alias="displayDescription") related_data: Optional[StrictStr] = Field(default=None, description="Any additional data associated with the rule, such as an image URL, vendor name, or a content management system (CMS) ID. ", alias="relatedData") - __properties: ClassVar[List[str]] = ["title", "displayName", "displayDescription", "relatedData"] + eligibility: Optional[List[RuleEligibility]] = None + __properties: ClassVar[List[str]] = ["title", "displayName", "displayDescription", "relatedData", "eligibility"] model_config = ConfigDict( validate_by_name=True, @@ -72,6 +74,13 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in eligibility (list) + _items = [] + if self.eligibility: + for _item_eligibility in self.eligibility: + if _item_eligibility: + _items.append(_item_eligibility.to_dict()) + _dict['eligibility'] = _items return _dict @classmethod @@ -87,7 +96,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "title": obj.get("title"), "displayName": obj.get("displayName"), "displayDescription": obj.get("displayDescription"), - "relatedData": obj.get("relatedData") + "relatedData": obj.get("relatedData"), + "eligibility": [RuleEligibility.from_dict(_item) for _item in obj["eligibility"]] if obj.get("eligibility") is not None else None }) return _obj diff --git a/talon_one/models/secondary_deployment.py b/talon_one/models/secondary_deployment.py index e0851ae..597e15f 100644 --- a/talon_one/models/secondary_deployment.py +++ b/talon_one/models/secondary_deployment.py @@ -42,6 +42,9 @@ class SecondaryDeployment(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-z0-9]+$", value): raise ValueError(r"must validate the regular expression /^[a-z0-9]+$/") return value diff --git a/talon_one/models/transfer_loyalty_card.py b/talon_one/models/transfer_loyalty_card.py index ea8f5b5..1b5dae3 100644 --- a/talon_one/models/transfer_loyalty_card.py +++ b/talon_one/models/transfer_loyalty_card.py @@ -35,6 +35,9 @@ class TransferLoyaltyCard(BaseModel): @field_validator('new_card_identifier') def new_card_identifier_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z0-9._%+@-]+$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z0-9._%+@-]+$/") return value diff --git a/talon_one/models/update_achievement.py b/talon_one/models/update_achievement.py index 74f7923..e4d0d97 100644 --- a/talon_one/models/update_achievement.py +++ b/talon_one/models/update_achievement.py @@ -49,6 +49,9 @@ def name_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/update_achievement_v2.py b/talon_one/models/update_achievement_v2.py index 5564efa..053c28f 100644 --- a/talon_one/models/update_achievement_v2.py +++ b/talon_one/models/update_achievement_v2.py @@ -50,6 +50,9 @@ def name_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z]\w+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z]\w+$/") return value diff --git a/talon_one/models/update_audience.py b/talon_one/models/update_audience.py index 50df29f..168ca14 100644 --- a/talon_one/models/update_audience.py +++ b/talon_one/models/update_audience.py @@ -17,8 +17,8 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self @@ -29,7 +29,8 @@ class UpdateAudience(BaseModel): UpdateAudience """ # noqa: E501 name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The human-friendly display name for this audience.") - __properties: ClassVar[List[str]] = ["name"] + subscribed_applications_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of the IDs of the Applications that are connected to this audience.", alias="subscribedApplicationsIds") + __properties: ClassVar[List[str]] = ["name", "subscribedApplicationsIds"] model_config = ConfigDict( validate_by_name=True, @@ -82,7 +83,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "name": obj.get("name") + "name": obj.get("name"), + "subscribedApplicationsIds": obj.get("subscribedApplicationsIds") }) return _obj diff --git a/talon_one/models/update_custom_effect.py b/talon_one/models/update_custom_effect.py index 44fb14b..97377cc 100644 --- a/talon_one/models/update_custom_effect.py +++ b/talon_one/models/update_custom_effect.py @@ -42,6 +42,9 @@ class UpdateCustomEffect(BaseModel): @field_validator('name') def name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z](\w|\s)*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z](\w|\s)*$/") return value @@ -49,6 +52,9 @@ def name_validate_regular_expression(cls, value): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[^[:cntrl:]\s][^[:cntrl:]]*$", value): raise ValueError(r"must validate the regular expression /^[^[:cntrl:]\s][^[:cntrl:]]*$/") return value diff --git a/talon_one/models/update_reward.py b/talon_one/models/update_reward.py new file mode 100644 index 0000000..e2952b0 --- /dev/null +++ b/talon_one/models/update_reward.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from talon_one.models.binding import Binding +from talon_one.models.rule import Rule +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class UpdateReward(BaseModel): + """ + UpdateReward + """ # noqa: E501 + name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The name of the reward.") + description: Optional[StrictStr] = Field(default=None, description="A description of the reward.") + status: StrictStr = Field(description="The status of the reward.") + rule: Optional[List[Rule]] = Field(default=None, description="Rule to apply. **Note**: The `bindings` field inside the rule must not be used in this endpoint. All bindings should be defined at the reward level via the top-level `bindings` field. ") + bindings: Optional[List[Binding]] = Field(default=None, description="A list of named variables created before the reward's rules are evaluated. Each binding pairs a name with a talang expression. The expression is evaluated once and its result is available by name in any rule condition or effect. Bindings must be defined outside of individual rules.") + __properties: ClassVar[List[str]] = ["name", "description", "status", "rule", "bindings"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['active', 'inactive']): + raise ValueError("must be one of enum values ('active', 'inactive')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateReward from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in rule (list) + _items = [] + if self.rule: + for _item_rule in self.rule: + if _item_rule: + _items.append(_item_rule.to_dict()) + _dict['rule'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in bindings (list) + _items = [] + if self.bindings: + for _item_bindings in self.bindings: + if _item_bindings: + _items.append(_item_bindings.to_dict()) + _dict['bindings'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateReward from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "description": obj.get("description"), + "status": obj.get("status"), + "rule": [Rule.from_dict(_item) for _item in obj["rule"]] if obj.get("rule") is not None else None, + "bindings": [Binding.from_dict(_item) for _item in obj["bindings"]] if obj.get("bindings") is not None else None + }) + return _obj + + diff --git a/talon_one/models/webhook.py b/talon_one/models/webhook.py index 191f491..83b5cf4 100644 --- a/talon_one/models/webhook.py +++ b/talon_one/models/webhook.py @@ -49,6 +49,9 @@ class Webhook(BaseModel): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/talon_one/models/webhook_authentication_webhook_ref.py b/talon_one/models/webhook_authentication_webhook_ref.py index b9988b3..dc94c16 100644 --- a/talon_one/models/webhook_authentication_webhook_ref.py +++ b/talon_one/models/webhook_authentication_webhook_ref.py @@ -36,6 +36,9 @@ class WebhookAuthenticationWebhookRef(BaseModel): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/talon_one/models/webhook_with_outgoing_integration_details.py b/talon_one/models/webhook_with_outgoing_integration_details.py index 34ce8b6..8c6927f 100644 --- a/talon_one/models/webhook_with_outgoing_integration_details.py +++ b/talon_one/models/webhook_with_outgoing_integration_details.py @@ -52,6 +52,9 @@ class WebhookWithOutgoingIntegrationDetails(BaseModel): @field_validator('title') def title_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[A-Za-z][A-Za-z0-9_.!~*\'() -]*$", value): raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9_.!~*'() -]*$/") return value diff --git a/test/test_audience.py b/test/test_audience.py index de8009f..ec79b7c 100644 --- a/test/test_audience.py +++ b/test/test_audience.py @@ -41,6 +41,7 @@ def make_instance(self, include_optional) -> Audience: name = 'Travel audience', sandbox = True, description = 'Travel audience 18-27', + subscribed_applications_ids = [3, 13], integration = 'mparticle', integration_id = '382370BKDB946', created_in3rd_party = False, diff --git a/test/test_campaign_eligibility.py b/test/test_campaign_eligibility.py new file mode 100644 index 0000000..4e2ed03 --- /dev/null +++ b/test/test_campaign_eligibility.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from talon_one.models.campaign_eligibility import CampaignEligibility + +class TestCampaignEligibility(unittest.TestCase): + """CampaignEligibility unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CampaignEligibility: + """Test CampaignEligibility + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CampaignEligibility` + """ + model = CampaignEligibility() + if include_optional: + return CampaignEligibility( + id = 4, + application_id = 322, + name = 'Summer promotions', + description = 'Campaign for all summer 2021 promotions', + start_time = '2021-07-20T22:00:00Z', + end_time = '2021-09-22T22:00:00Z', + attributes = None, + state = 'enabled', + tags = [summer], + features = [coupons, referrals], + rules = [ + talon_one.models.rule_metadata.RuleMetadata( + title = 'Give discount via coupon', + display_name = '20% off all shoes!', + display_description = 'Get a 20% discount on all shoes during Thanksgiving! Offer valid till Dec 5 only.', + related_data = 'https://example.com/discounts/20-off-shoes.png', + eligibility = [ + talon_one.models.rule_eligibility.RuleEligibility( + passed = True, + coupon_code = '', + details = null, ) + ], ) + ], + eligibility = [ + talon_one.models.campaign_eligibility_details.CampaignEligibilityDetails( + passed = True, + coupon_code = '', + details = null, ) + ] + ) + else: + return CampaignEligibility( + id = 4, + application_id = 322, + name = 'Summer promotions', + state = 'enabled', + tags = [summer], + features = [coupons, referrals], + eligibility = [ + talon_one.models.campaign_eligibility_details.CampaignEligibilityDetails( + passed = True, + coupon_code = '', + details = null, ) + ], + ) + """ + + def testCampaignEligibility(self): + """Test CampaignEligibility""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_campaign_eligibility_details.py b/test/test_campaign_eligibility_details.py new file mode 100644 index 0000000..77876c9 --- /dev/null +++ b/test/test_campaign_eligibility_details.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from talon_one.models.campaign_eligibility_details import CampaignEligibilityDetails + +class TestCampaignEligibilityDetails(unittest.TestCase): + """CampaignEligibilityDetails unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CampaignEligibilityDetails: + """Test CampaignEligibilityDetails + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CampaignEligibilityDetails` + """ + model = CampaignEligibilityDetails() + if include_optional: + return CampaignEligibilityDetails( + passed = True, + coupon_code = '', + details = talon_one.models.campaign_eligibility_failure_details.CampaignEligibilityFailureDetails( + failure_code = 'ALL_RULES_FAILED', ) + ) + else: + return CampaignEligibilityDetails( + passed = True, + ) + """ + + def testCampaignEligibilityDetails(self): + """Test CampaignEligibilityDetails""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_campaign_eligibility_failure_details.py b/test/test_campaign_eligibility_failure_details.py new file mode 100644 index 0000000..8d5bd3f --- /dev/null +++ b/test/test_campaign_eligibility_failure_details.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from talon_one.models.campaign_eligibility_failure_details import CampaignEligibilityFailureDetails + +class TestCampaignEligibilityFailureDetails(unittest.TestCase): + """CampaignEligibilityFailureDetails unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CampaignEligibilityFailureDetails: + """Test CampaignEligibilityFailureDetails + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CampaignEligibilityFailureDetails` + """ + model = CampaignEligibilityFailureDetails() + if include_optional: + return CampaignEligibilityFailureDetails( + failure_code = 'ALL_RULES_FAILED' + ) + else: + return CampaignEligibilityFailureDetails( + failure_code = 'ALL_RULES_FAILED', + ) + """ + + def testCampaignEligibilityFailureDetails(self): + """Test CampaignEligibilityFailureDetails""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_customer_profile_integration_response_v2.py b/test/test_customer_profile_integration_response_v2.py index ba7a709..86ceb52 100644 --- a/test/test_customer_profile_integration_response_v2.py +++ b/test/test_customer_profile_integration_response_v2.py @@ -72,6 +72,9 @@ def make_instance(self, include_optional) -> CustomerProfileIntegrationResponseV evaluation_group_id = 3, evaluation_group_mode = 'stackable', ) ], + campaign_eligibility = [ + null + ], awarded_giveaways = [ null ], diff --git a/test/test_integration_campaign.py b/test/test_integration_campaign.py index 1572764..e4338df 100644 --- a/test/test_integration_campaign.py +++ b/test/test_integration_campaign.py @@ -44,7 +44,20 @@ def make_instance(self, include_optional) -> IntegrationCampaign: attributes = None, state = 'enabled', tags = [summer], - features = [coupons, referrals] + features = [coupons, referrals], + rules = [ + talon_one.models.rule_metadata.RuleMetadata( + title = 'Give discount via coupon', + display_name = '20% off all shoes!', + display_description = 'Get a 20% discount on all shoes during Thanksgiving! Offer valid till Dec 5 only.', + related_data = 'https://example.com/discounts/20-off-shoes.png', + eligibility = [ + talon_one.models.rule_eligibility.RuleEligibility( + passed = True, + coupon_code = '', + details = null, ) + ], ) + ] ) else: return IntegrationCampaign( diff --git a/test/test_integration_event_v2_response.py b/test/test_integration_event_v2_response.py index 93cee0f..08f2d80 100644 --- a/test/test_integration_event_v2_response.py +++ b/test/test_integration_event_v2_response.py @@ -54,6 +54,9 @@ def make_instance(self, include_optional) -> IntegrationEventV2Response: triggered_campaigns = [ null ], + campaign_eligibility = [ + null + ], effects = [ null ], diff --git a/test/test_integration_event_v3_response.py b/test/test_integration_event_v3_response.py index 204d010..1b74b33 100644 --- a/test/test_integration_event_v3_response.py +++ b/test/test_integration_event_v3_response.py @@ -54,6 +54,9 @@ def make_instance(self, include_optional) -> IntegrationEventV3Response: triggered_campaigns = [ null ], + campaign_eligibility = [ + null + ], effects = [ null ], diff --git a/test/test_integration_response.py b/test/test_integration_response.py index 0354da3..5be3d65 100644 --- a/test/test_integration_response.py +++ b/test/test_integration_response.py @@ -54,6 +54,9 @@ def make_instance(self, include_optional) -> IntegrationResponse: triggered_campaigns = [ null ], + campaign_eligibility = [ + null + ], effects = [ null ], diff --git a/test/test_integration_state_v2.py b/test/test_integration_state_v2.py index ae71a41..2ee0d7a 100644 --- a/test/test_integration_state_v2.py +++ b/test/test_integration_state_v2.py @@ -54,6 +54,9 @@ def make_instance(self, include_optional) -> IntegrationStateV2: triggered_campaigns = [ null ], + campaign_eligibility = [ + null + ], effects = [ null ], diff --git a/test/test_multiple_audiences_item.py b/test/test_multiple_audiences_item.py index 9b773ff..d7329f6 100644 --- a/test/test_multiple_audiences_item.py +++ b/test/test_multiple_audiences_item.py @@ -38,6 +38,7 @@ def make_instance(self, include_optional) -> MultipleAudiencesItem: id = 6, created = '2020-06-10T09:05:27.993483Z', name = 'Travel audience', + subscribed_applications_ids = [3, 13], integration_id = '382370BKDB946', status = 'new' ) diff --git a/test/test_new_audience.py b/test/test_new_audience.py index 14abb6f..a254abd 100644 --- a/test/test_new_audience.py +++ b/test/test_new_audience.py @@ -38,6 +38,7 @@ def make_instance(self, include_optional) -> NewAudience: name = 'Travel audience', sandbox = True, description = 'Travel audience 18-27', + subscribed_applications_ids = [3, 13], integration = 'mparticle', integration_id = '382370BKDB946', created_in3rd_party = False, diff --git a/test/test_new_internal_audience.py b/test/test_new_internal_audience.py index e229a06..4420b00 100644 --- a/test/test_new_internal_audience.py +++ b/test/test_new_internal_audience.py @@ -37,7 +37,8 @@ def make_instance(self, include_optional) -> NewInternalAudience: return NewInternalAudience( name = 'Travel audience', sandbox = True, - description = 'Travel audience 18-27' + description = 'Travel audience 18-27', + subscribed_applications_ids = [3, 13] ) else: return NewInternalAudience( diff --git a/test/test_new_multiple_audiences_item.py b/test/test_new_multiple_audiences_item.py index a5b9c06..bb4242d 100644 --- a/test/test_new_multiple_audiences_item.py +++ b/test/test_new_multiple_audiences_item.py @@ -36,6 +36,7 @@ def make_instance(self, include_optional) -> NewMultipleAudiencesItem: if include_optional: return NewMultipleAudiencesItem( name = 'Travel audience', + subscribed_applications_ids = [3, 13], integration_id = '382370BKDB946' ) else: diff --git a/test/test_new_reward.py b/test/test_new_reward.py index c42ea74..f9a26c3 100644 --- a/test/test_new_reward.py +++ b/test/test_new_reward.py @@ -39,7 +39,28 @@ def make_instance(self, include_optional) -> NewReward: api_name = 'free-coffee', description = 'This reward gets you one free coffee.', application_ids = [1, 2, 3], - sandbox = True + sandbox = True, + rule = [ + talon_one.models.rule.Rule( + id = '7fa800a8-ac8d-4792-85dc-c4650dcc8f23', + parent_id = '7fa800a8-ac8d-4792-85dc-c4650dcc8f23', + title = 'Give discount via coupon', + description = 'Creates a discount when a coupon is valid', + bindings = [ + talon_one.models.binding.Binding( + name = 'my property', + type = 'templateParameter', + expression = [string1, string2], + value_type = 'string', + min_value = 0, + max_value = 19.9, + attribute_id = 100, + description = 'This is a template parameter of type `number`.', ) + ], + condition = [and, [couponValid]], + effects = [catch, [noop], [setDiscount, 10% off, [*, [., Session, Total], [/, 10, 100]]]], ) + ], + bindings = [] ) else: return NewReward( diff --git a/test/test_reward.py b/test/test_reward.py index ae35cdc..20bf296 100644 --- a/test/test_reward.py +++ b/test/test_reward.py @@ -43,6 +43,27 @@ def make_instance(self, include_optional) -> Reward: description = 'This reward gets you one free coffee.', application_ids = [1, 2, 3], sandbox = True, + rule = [ + talon_one.models.rule.Rule( + id = '7fa800a8-ac8d-4792-85dc-c4650dcc8f23', + parent_id = '7fa800a8-ac8d-4792-85dc-c4650dcc8f23', + title = 'Give discount via coupon', + description = 'Creates a discount when a coupon is valid', + bindings = [ + talon_one.models.binding.Binding( + name = 'my property', + type = 'templateParameter', + expression = [string1, string2], + value_type = 'string', + min_value = 0, + max_value = 19.9, + attribute_id = 100, + description = 'This is a template parameter of type `number`.', ) + ], + condition = [and, [couponValid]], + effects = [catch, [noop], [setDiscount, 10% off, [*, [., Session, Total], [/, 10, 100]]]], ) + ], + bindings = [], status = 'active' ) else: diff --git a/test/test_rule_eligibility.py b/test/test_rule_eligibility.py new file mode 100644 index 0000000..8955088 --- /dev/null +++ b/test/test_rule_eligibility.py @@ -0,0 +1,62 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from talon_one.models.rule_eligibility import RuleEligibility + +class TestRuleEligibility(unittest.TestCase): + """RuleEligibility unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> RuleEligibility: + """Test RuleEligibility + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `RuleEligibility` + """ + model = RuleEligibility() + if include_optional: + return RuleEligibility( + passed = True, + coupon_code = '', + details = talon_one.models.rule_eligibility_failure_details.RuleEligibilityFailureDetails( + failure_code = 'CONDITION_NOT_MET', + coupon_id = 4928, + coupon_value = '', + referral_id = 56, + referral_value = '', + condition_index = 56, + effect_index = 56, + details = '', ) + ) + else: + return RuleEligibility( + passed = True, + ) + """ + + def testRuleEligibility(self): + """Test RuleEligibility""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_rule_eligibility_failure_details.py b/test/test_rule_eligibility_failure_details.py new file mode 100644 index 0000000..7df67ce --- /dev/null +++ b/test/test_rule_eligibility_failure_details.py @@ -0,0 +1,60 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from talon_one.models.rule_eligibility_failure_details import RuleEligibilityFailureDetails + +class TestRuleEligibilityFailureDetails(unittest.TestCase): + """RuleEligibilityFailureDetails unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> RuleEligibilityFailureDetails: + """Test RuleEligibilityFailureDetails + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `RuleEligibilityFailureDetails` + """ + model = RuleEligibilityFailureDetails() + if include_optional: + return RuleEligibilityFailureDetails( + failure_code = 'CONDITION_NOT_MET', + coupon_id = 4928, + coupon_value = '', + referral_id = 56, + referral_value = '', + condition_index = 56, + effect_index = 56, + details = '' + ) + else: + return RuleEligibilityFailureDetails( + failure_code = 'CONDITION_NOT_MET', + details = '', + ) + """ + + def testRuleEligibilityFailureDetails(self): + """Test RuleEligibilityFailureDetails""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_rule_metadata.py b/test/test_rule_metadata.py index 79ce751..59f120e 100644 --- a/test/test_rule_metadata.py +++ b/test/test_rule_metadata.py @@ -38,7 +38,13 @@ def make_instance(self, include_optional) -> RuleMetadata: title = 'Give discount via coupon', display_name = '20% off all shoes!', display_description = 'Get a 20% discount on all shoes during Thanksgiving! Offer valid till Dec 5 only.', - related_data = 'https://example.com/discounts/20-off-shoes.png' + related_data = 'https://example.com/discounts/20-off-shoes.png', + eligibility = [ + talon_one.models.rule_eligibility.RuleEligibility( + passed = True, + coupon_code = '', + details = null, ) + ] ) else: return RuleMetadata( diff --git a/test/test_update_audience.py b/test/test_update_audience.py index f730f8b..f3e66bf 100644 --- a/test/test_update_audience.py +++ b/test/test_update_audience.py @@ -35,7 +35,8 @@ def make_instance(self, include_optional) -> UpdateAudience: model = UpdateAudience() if include_optional: return UpdateAudience( - name = 'Travel audience' + name = 'Travel audience', + subscribed_applications_ids = [3, 13] ) else: return UpdateAudience( diff --git a/test/test_update_reward.py b/test/test_update_reward.py new file mode 100644 index 0000000..c0aea14 --- /dev/null +++ b/test/test_update_reward.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Talon.One API + + Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) to integrate with our platform. - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`. + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from talon_one.models.update_reward import UpdateReward + +class TestUpdateReward(unittest.TestCase): + """UpdateReward unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> UpdateReward: + """Test UpdateReward + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `UpdateReward` + """ + model = UpdateReward() + if include_optional: + return UpdateReward( + name = 'Free Coffee', + description = 'This reward gets you one free coffee.', + status = 'active', + rule = [ + talon_one.models.rule.Rule( + id = '7fa800a8-ac8d-4792-85dc-c4650dcc8f23', + parent_id = '7fa800a8-ac8d-4792-85dc-c4650dcc8f23', + title = 'Give discount via coupon', + description = 'Creates a discount when a coupon is valid', + bindings = [ + talon_one.models.binding.Binding( + name = 'my property', + type = 'templateParameter', + expression = [string1, string2], + value_type = 'string', + min_value = 0, + max_value = 19.9, + attribute_id = 100, + description = 'This is a template parameter of type `number`.', ) + ], + condition = [and, [couponValid]], + effects = [catch, [noop], [setDiscount, 10% off, [*, [., Session, Total], [/, 10, 100]]]], ) + ], + bindings = [] + ) + else: + return UpdateReward( + name = 'Free Coffee', + status = 'active', + ) + """ + + def testUpdateReward(self): + """Test UpdateReward""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()